Daily Shaarli

All links of one day in a single page.

October 9, 2020

Don't write command-line interfaces (and how to write if you have to)

Plutôt que clize (ou click), il est proposé de passer par hug ou typer.

Le truc marrant, c'est qu'il est tout à fait possible d'appeler une fonction en lui passant des paramètres nommés. Type

python -m mymodule \
    set_dragon_feeding_schedule \
    --feeding-times ['10:00','14:00','18:00'] # hopefully this way it gets recognized \
    # how will you define parsing a dict with string to integer mapping? 
    --dishes=Creatures.Tiger:2 \
    --dishes=Creatures.Human:1 \
    --start-day=1020-03-21 # BTW bash allows no comments in multiline calls