termsaver
termsaver copied to clipboard
command line options together don't work (-hv as opposed to -h -v)
Produces: the result:
termsaver -hv
Oops! Invalid use of option. It seems you chose an invalid option.. See --help for details.
How did you envision handling this? I have a branch where I'm playing with the idea now and there are multiple ways we could approach it.
Am I correct to assume this would only apply to arguments that were parameterless?
If so, what are the thoughts on modifying the programs core so we had to indicate if an argument needed parameters or not (the same way we indicate what their longname is?). This would allow parsing of each "type" of argument separately and grouping the parameterless arguments together might be easier.
Yeah the issue now is that I send the parameters to the screen code so it can parse the individual options of each screen, that's why it is not using the standard getopt. Ideally, we would get everything in the 'termsaver' script (the one without .py), and pass the parsed arguments when instantiating the screen class...
Worked out a solution. It'll take a day or so for me to implement fully. I think you'll like it.
When you test this, make sure you look at bash_completion functionality as well (you hit TAB and it auto completes the screens or subsequent options)
When you test this, make sure you look at bash_completion functionality as well (you hit TAB and it auto completes the screens or subsequent options)
Will do.
What are your thoughts on argparse? I've worked out a branch that implements it, however it required some major modifications to ScreenBase and some of the helper bases but it autogens usage for us and gives better control over specific options, handles '-h' on its own, etc.
I'd be happy to start a Draft PR if you're interested in seeing it.
Much better than manually or the old getopts. When I first wrote it I don’t think we had that yet.
On Mon, 7 Sep 2020 at 12:24, Eddie Dover [email protected] wrote:
When you test this, make sure you look at bash_completion functionality as well (you hit TAB and it auto completes the screens or subsequent options)
Will do.
What are your thoughts on argparse https://docs.python.org/3/library/argparse.html? I've worked out a branch that implements it, however it required some major modifications to ScreenBase and some of the helper bases but it autogens usage for us and gives better control over specific options, handles '-h' on its own, etc.
I'd be happy to start a Draft PR if you're interested in seeing it.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/brunobraga/termsaver/issues/46#issuecomment-687984878, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAUADHNZHX6CC3TXTT5QJTSEQ75PANCNFSM4QLGKWIQ .
--
--Bruno Braga [email protected] +61-452-212-910