Skip to content

[idea] Make subcommands for subcommands #347

@kindermax

Description

@kindermax

Allow lets to have subcommands for subcommands, for example

lets user create
lets user delete

There are many ways to express it via yaml

Option A:

  • pros:
    • explicit relation between commands, we see who is parent, who is child of some parent
    • we can grep parent: <> to see subcommands
  • cons:
    • lots of changes in schema
commands:
  user:
    type: parent
    
  user_create:
    parent: user
    cmd: ...

  user_delete:
    parent: user
    cmd: ...

Option B:

  • pros:
    • less changes that in A, only parent command
    • we can see in parent, which commands are subcommands and we can see it in one place
    • if some command is added to parent, it is hidden from commands output of lets help
  • cons:
    • not explicit if command is a subcommand and if it is hidden
commands:
  user:
    commands:
      - user_create
      - user_delete
    
  user_create:
    cmd: ...

  user_delete:
     cmd: ...

Option C:

  • pros:
    • less changes that in A, only add commands to Command
    • we can see in parent, which commands are subcommands and we can see it in one place
    • explicit that this is a subcommand and that it is not be shown in lets help
  • cons:
    • one more layer of indentation
commands:
  user:
    commands:
       user_create:
         cmd: ...
      user_delete:
         cmd: ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions