question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Why are my commands appearing as subcommands?

See original GitHub issue

Hello,

I’m wondering why the commands I’ve defined, appear as subcommands, instead of “main” commands.

For example, I’ve defined something like the following:

    @expose(
        help='some help',
        aliases=['alias'],
        arguments=[
            (['args'], dict(action='store', nargs='*')),
        ]
    )
    def some_command(self):
        pass

And, when I execute the application for showing the help, this is how appears:

usage: app [-h] [--debug] [--quiet] {some_command, alias} ...

An app

optional arguments:
  -h, --help            show this help message and exit
  --debug               toggle debug output
  --quiet               suppress all output

sub-commands:
  {some_command, alias}
    some_command (alias) some help

The command invocation works fine; it’s just that I was expecting to make the commands appear as in the quickstart.

Many thanks for your work.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
akhilmancommented, Feb 20, 2017

Add this to your controller’s Meta: stacked_on = ‘base’     stacked_type = ‘embedded’

More info here: http://builtoncement.com/2.10/dev/controllers.html#addi tional-controllers-and-namespaces

On Mon, 2017-02-20 at 09:51 -0800, Julen Pardo wrote:

Hello,

I’m wondering why the commands I’ve defined, appear as subcommands, instead of “main” commands.

For example, I’ve defined something like the following:

    @expose(
        help='some help',
        aliases=['alias'],
        arguments=[
            (['args'], dict(action='store', nargs='*')),
        ]
    )
    def some_command(self):
        pass

And, when I execute the application for showing the help, this is how appears:

usage: app [-h] [--debug] [--quiet] {some_command, alias} ...

An app

optional arguments:
  -h, --help            show this help message and exit
  --debug               toggle debug output
  --quiet               suppress all output

sub-commands:
  {some_command, alias}
    some_command (alias) some help

The command invocation works fine; it’s just that I was expecting to make the commands appear as in the [quickstart](http://builtoncement. com/2.10/dev/quickstart.html).

Many thanks for your work.

1reaction
derkscommented, Feb 21, 2017

@julenpardo I think I understand now. You are asking why the output of ‘–help’ is different than the QuickStart example? All of the dicumentIon currently references use of ‘CementBaseController’ which will look different. That said, You do want to use ArgparseController because it will be the standard moving forward.

If you need to customize the output of how --help looks you might want to research how it would be done with Argeparse directly… then I could help integrate that into Cement. CementBaseController is very hacky… where ArgparseController uses proper ArgparseController mechanisms for creating subcommabds via subparsers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

modify sub commands?? - Autodesk Community - AutoCAD
Solved: I'm currently enrolled in an entry level AutoCAD class, and I'm having a bit of trouble answering a question on an assignment...
Read more >
In Python Click how do I see --help for Subcommands whose ...
I have done something like this: class PerCommandOptWantSubCmdHelp(click.Option): def handle_parse_result(self, ctx, opts, args): # check to ...
Read more >
Working with help subcommands of recent CLI tools
Asking for help, clarification, or responding to other answers. Making statements based on opinion ; back them up with references or personal ...
Read more >
svn Reference—Subversion Command-Line Client
svn is the official command-line client of Subversion. Its functionality is offered via a collection of task-specific subcommands, most of which accept a ......
Read more >
Commands and Groups — Click Documentation (7.x)
Click strictly separates parameters between commands and subcommands. ... Commands can also ask for the context to be passed by marking themselves with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found