cmmorrow / build-magic

A general purpose build/install/deploy tool.
MIT License
9 stars 2 forks source link

Add support for command labels #77

Closed cmmorrow closed 2 years ago

cmmorrow commented 2 years ago

Is your feature request related to a problem? Please describe. Seeing a long shell command in the build-magic export doesn't always make it clear what is happening. It would be good to be able to provide an optional description of the command to display instead of the command itself.

Describe the solution you'd like A command label can be added by using a --label option. Each --label should sequentially correspond to a provided command. If the number of commands do not match the number of labels, an error should be raised to let the user know.

In the case of config files, a label: object can optionally be provided for a command like the following:

commands:
  - build: make all
    label: Compile myapp and run tests.

The implementation should be done by adding --label to the CLI and the label: object to config_schema.json. The labels will need to be matched to commands and passed to the build_stage() function. The MacroFactory constructor will also need to be modified to accept the label as an argument and set it as a property. When Stage.run() executes the macro, it should display the description in the Macro's label property if it exists, otherwise the command is displayed.