piotrmurach / tty

Toolkit for developing sleek command line apps.
https://ttytoolkit.org
MIT License
2.5k stars 78 forks source link

Question: How does options work? #39

Closed hasanen closed 6 years ago

hasanen commented 6 years ago

I see that @options get passed for the command, but how do I get anything in there?

For example if I wanted to have following commands:

# using config-command to set value
app config foo=bar

# using config-command to read value
app config foo

# giving a flag for the command
app calculate_something --refresh-cache

Perhaps this is something that is documented somewhere, but I've missed that.

charignon commented 6 years ago

I sent out a pull request to explain this better see https://github.com/piotrmurach/tty/pull/40

piotrmurach commented 6 years ago

@hasanen Apologies for not replying to you earlier. I have been sidetracked into fixing/improving few tty components. In future please ping me if I don't reply. I will write up a section addressing different types of flags and how to code them.

@charignon Thank you for submitting PR! Unfortunately I won't merge it and here is why. I want to provide a through documentation on how to work with flags, options and arguments so that both beginners and advanced users know exactly how things are done. Referencing a file doesn't necessarily explain all available features. I'm happy for us to collaborate on the docs. If you have any ideas please submit them.

hasanen commented 6 years ago

@piotrmurach no problem, I've been quite busy myself too, but I'll keep it mind. Thanks!

piotrmurach commented 6 years ago

@hasanen I have finally added docs for options and flags that should hopefully provide all the necessary info to do the things you wish to do in your examples. Please see Options and Flags.

@charignon I've added the missing docs for flags, options etc... but still need to flesh out arguments and subcommands. Would appreciate any help either with the docs or testing/contributing to the teletype executable.