tailhook / vagga

Vagga is a containerization tool without daemons
http://vagga.readthedocs.org
MIT License
1.86k stars 96 forks source link

Support for SubCommands #66

Open lilianmoraru opened 8 years ago

lilianmoraru commented 8 years ago

I think it would be great to have support for SubCommands. The idea is to be able to execute a command like this: vagga build QtCreator3.4.0 Qt5.2.1 Ubuntu14.04.3 vagga test parser-tests yaml instead of: vagga build-QtCreator3.4.0-Qt5.2.1-Ubuntu14.04.3 vagga test-parser-tests-yaml

When you would write for example: vagga build you would get the list:

Available commands:
    QtCreator3.4.0 - description
    QtCreator3.4.1 - description
    QtCreator3.4.2 - description
    ...

This could probably look something like Supervise is right now with the children option. A !Command could have children-or-some-other-keyword(subcommands?)

Also, it would be nice if commands could also be imported from another .yaml the same way configs for containers can be imported.

vagga/
  vagga/test.yaml
  vagga/test/
    vagga/test/parser-tests.yaml
    vagga/test/completion-tests.yaml
    vagga/test/audio-tests.yaml
    vagga/test/synth-tests.yaml
  ...
  vagga/build.yaml
  vagga/build/
  ...
  vagga/bench.yaml
  vagga/bench/
  ...
vagga.yaml:
  ...
  commands:
    test: !Command
      subconfig?:
        ?path: vagga/test.yaml
      description: ...

    build: !Command
      subcommands?:
         subconfig?: vagga/build.yaml
tailhook commented 8 years ago

Sounds nice. Except command syntax might better look like:

commands:
  build: !Group
    subcommands:
      cmd1: !Command ...
      cmd2: !Command ...

I don't think I'll have the time to work on this soon. But it should be pretty easy to implement, because it doesn't need any changes to way containerization is done. Just requires some fiddling with the configuration. So contributions are welcome.