krieselreihe / litr

Litr (Language Independent Task Runner) lets you configure and then run any tasks you want for any language.
MIT License
8 stars 0 forks source link

Show help text #25

Closed MartinHelmut closed 3 years ago

MartinHelmut commented 3 years ago

Currently the special parameter -h / --help does nothing. Goal is that this will print a beautiful auto generated help text inside the terminal.

Reference material:

MartinHelmut commented 3 years ago

First idea for output:

Litr - Language Independent Task Runner [version 1.0.0]
  Configuration file found under: /Users/martin/Projects/krieselreihe/litr/litr.toml

Usage:
  test   [--target=<option>] [--trace]
                        Some nice description for the test command.
  build  [--target=<option>] [--trace]
  run    [--target=<option>] [--trace]
  update

Options:
  -h --help             Show this screen.
     --something        Lorem ipsum dolor sit amet, consectetur adipiscing elit,
                        sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
                        enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi.
  -t --trace            Activate tracing support.
  -t --target=<option>  Define the application build target.
                        Available options: "debug", "release", "profile", "trace"
MartinHelmut commented 3 years ago

First workable draft (https://github.com/krieselreihe/litr/commit/239dad09fee726702e2773db6f5d6c7ef3398a0b):

Litr - Language Independent Task Runner [version 1.0.0]
  Configuration file found under: /Users/martin/Projects/krieselreihe/litr/litr.toml

Usage: litr command [options]

Commands:
  test    [--target=<option>]
  build   [--trace] [--target=<option>]
  run     [--target=<option>]
  update

Options:
  -h --help             Show this screen.
     --something        Lorem ipsum dolor sit amet, consectetur adipiscing elit,
                        sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
                        enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi.
  -r --trace            Activate tracing support.
  -t --target=<option>  Define the application build target.
                        Available options: "debug", "release", "profile", "trace"
                        Default option is: "debug"
MartinHelmut commented 3 years ago

Currently there is only the global help available (litr --help) but not a command specific. Given the following execution:

litr run --help

This should be the expected help:

Litr - Language Independent Task Runner [version 1.0.0]
  Configuration file found under: /Users/martin/Projects/krieselreihe/litr/litr.toml

Usage: litr run [options]

Options:
  -h --help             Show this screen.
  -t --target=<option>  Define the application build target.
                        Available options: "debug", "release", "profile", "trace"
                        Default option is: "debug"
MartinHelmut commented 3 years ago

Command help is implemented with 09f39c5dd6a92357313f5992210329bc8de5a1a0 . Questions remains, how to show help for nested commands.

MartinHelmut commented 3 years ago

Nested command help idea:

Litr - Language Independent Task Runner [version 1.0.0]
  Configuration file found under: /Users/martin/Projects/krieselreihe/litr/litr.toml

Usage: litr command [options]

Commands:
  test    [--target=<option>]
    cpp   [--target=<option>]
    java  [--target=<option>]
  build   [--trace] [--target=<option>]
  run     [--target=<option>]
  update

Options:
  -h --help             Show this screen.
     --something        Lorem ipsum dolor sit amet, consectetur adipiscing elit,
                        sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
                        enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi.
  -r --trace            Activate tracing support.
  -t --target=<option>  Define the application build target.
                        Available options: "debug", "release", "profile", "trace"
                        Default option is: "debug"