Skip to content
This repository was archived by the owner on May 30, 2022. It is now read-only.
This repository was archived by the owner on May 30, 2022. It is now read-only.

Allow for a default subcommand #67

@rodr0m4

Description

@rodr0m4

First and foremost:

  • My english sucks
  • This library is amazing! (I was looking for a way to quickly make CLIs with interactive + non-interactive mode without repeating logic and this was exactly what I was looking for :) ).

Given something like this:

@command
class Token:
  @command
  def provider_a():
    get_token_for_provider_a()

  @command
  def provider_b():
    get_token_for_provider_b()

I'd like to provide a default subcommand to call when no arguments are passed, so I could call that command like:

> cli token

And behind the scenes token.provider_b() would be called, for example.

This is because doing something like cli token --provider=b is kinda verbose (at least for my use case).

Does this make sense? Or I'm trying to use subcommands for something that they are not intended for?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions