siemdejong / shit-happens

Create your own Shit Happens playing cards!
GNU General Public License v3.0
4 stars 2 forks source link

Move from argparse to click #28

Open siemdejong opened 1 year ago

siemdejong commented 1 year ago

Is your feature request related to a problem? Please describe. Sorting the cards can be done with the command line, which is accessed by the sorting flag. All other settings still need to be set, but will be disregarded.

Describe the solution you'd like Using a cli where I do not need to set settings which will not be used anyway, because I want to sort the cards, not create them.

Describe alternatives you've considered It is easier to separate sorting from creating cards with argparse subcommands. This will make usage more straightforward.

Additional context argparse.add_subparsers

siemdejong commented 1 year ago

click is a better option.

Just have two commands:

import click

@click.group()
def cli():
    pass

@cli.command()
@click.options(...)
def create(*args, **kwargs):
    create_cards(*args, **kwargs)

@cli.command()
@click.options(...)
def sort(*args, **kwargs):
    sort_situations(*args, **kwargs)

and set cli as entry point in setup.py.