Skip to content
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

"Prefer flags to args." could be misinterpreted #95

Open
ssokolow opened this issue Nov 1, 2021 · 0 comments
Open

"Prefer flags to args." could be misinterpreted #95

ssokolow opened this issue Nov 1, 2021 · 0 comments

Comments

@ssokolow
Copy link

ssokolow commented Nov 1, 2021

Prefer flags to args. It’s a bit more typing, but it makes it much clearer what is going on. It also makes it easier to make changes to how you accept input in the future. Sometimes when using args, it’s impossible to add new input without breaking existing behavior or creating ambiguity.

...

...

Multiple arguments are fine for simple actions against multiple files. For example, rm file1.txt file2.txt file3.txt. This also makes it work with globbing: rm *.txt.

Putting my novice hat on, I could easily see myself not connecting these two pieces of advice because of how far apart they are separated in the text and how the latter is neither a sub-point of the former nor using very strong phrasing for "this is an exception".

It'd probably be a good idea to tweak the phrasing of the first one.

Maybe something like this:

Prefer flags to args. Save args for when you have one primary input field that can be repeated, like a path or URL. It’s a bit more typing, but it makes it much clearer what is going on. It also makes it easier to make changes to how you accept input in the future. Sometimes when using args, it’s impossible to add new input without breaking existing behavior or creating ambiguity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant