-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document @file CLI arguments #391
Comments
@grodin, that's a common practice for CLIs and often CLI tools offer that right out of the box, but sure we could document that. Do you want to submit a PR for it? |
Can do. Should have some time next week. |
Starting work on this, I'd forgotten that the CLI is pretty barebones (e.g. lacks Or should I just document the Happy to do either, but might be overstepping the mark a bit with the first if you're wanting to keep the CLI ultra-minimal. |
I'd be happy to have it improved! 😃 Just maybe make it into different PRs, if possible |
Yep, no problem |
How far can I go in rebuilding the CLI? One option is to go the whole hog and use clikt but obviously that's a new dependency and possibly bloating a pretty small Jar. The current CLI behaviour is encoded in tests. Should I try to keep those tests passing or can I replace them? |
Although I love clikt and use it in other projects, we intentionally didn't use it (or other cli libs) to keep the library slim. Feel free to go as deep as you want on refactoring. |
Oh, just try not to change the CLI public API, unless it's really necessary. We're going with a 1.0 release, so that could warrant an API change. |
Some more clarity about this would be useful. The current implementation has a fair bit of unexpected behaviour: I reported #465 separately, but the other thing is that the style flags aren't mutually exclusive, e.g.
is valid. The last style option on the command line wins, so I find this fairly surprising, but I'm not certain how other CLI tools handle it. I think Clikt has the same behaviour by default, but it's not completely clear from their docs. |
Basically I meant that we should try not to change the options/params of the program.
This is something I would consider a change in the CLI API. Honestly this looks like a good change, IMHO and we could put that in the 1.0.0 release. Regarding how to handle multiple params, from my experience, it seems common for CLIs to just take the last params specified. The Kotlin compiler, for example, does that, only issuing a warning stating that multiple values were defined and it will take the last one. |
Summary: Working towards #391. I wanted to open this to get feedback on the approach. I could have chosen to use exceptions, but I find sealed classes much more composable and I already anticipate adding another class to the `ParseResult` hierarchy to represent a situation where a message needs to be shown to the user but isn't an error (`--help` is the obvious example). Closes #465 more or less as a side-effect. Pull Request resolved: #467 Reviewed By: strulovich Differential Revision: D58136233 Pulled By: hick209 fbshipit-source-id: 85662e7b5f19195c4bb4c9c28caa02ae224ede52
Are you still wanting the |
You can put that up as a separated PR |
To be clear, this is a change that breaks the CLI API, so it will be part of 1.0.0. Once this PR here lands, I'll make a v0.51 release and then could immediately merge the changes for |
Parsing args from a file if the first argument is
@filename
was introduced in this commit but doesn't seem to be documented anywhere apart from a cryptic hint in cli help. I only found it because I got curious so went digging in the source, but it's actually a useful feature which deserves documenting!The text was updated successfully, but these errors were encountered: