Conversation
vilmibm
left a comment
There was a problem hiding this comment.
I this is is a good first step!
We don't have good examples for some simple patterns, like mutually exclusive arguments. We have examples, but they are kind of complicated.
I think the example you used is fine.
Do we want to include more examples of things like "a required flag with mutually exclusive placeholder arguments"
Are there specific things we do right now that you are thinking of? I think it's okay to use a complicated example here; in trying to document it we might think of better ways to express or implement certain things.
mislav
left a comment
There was a problem hiding this comment.
google's document is pretty thorough, but doesn't follow the standards we've been using
I'm interested in where you've found google's document to differ from the standards we've been using? I've just combed through it and I cannot find it. It matches microsoft's document, except that it goes more in depth.
docs/command-line-syntax.md
Outdated
| @@ -0,0 +1,39 @@ | |||
| # How we document our command line syntax | |||
|
|
|||
| ## Required arguments | |||
There was a problem hiding this comment.
Could we say "literal" arguments instead of "required"?
E.g. in this invocation none of the arguments are really "required":
gh repo create myprojectThe last argument could be omitted and the command would still work, and the create argument isn't really a "required" argument for repo as much as it is one of the possible arguments for repo.
So I would say that anything that appears in plain text (i.e. not enclosed in brackets) should be taken verbatim.
There was a problem hiding this comment.
This is tricky. I think I see the word "required" modifying something different than you. I see it as "in the given usage string this arg is required" but you seeing as "this argument is required". The difference being in my interpretation the arg isn't always required, but in your interpretation it is.
So in the usage string gh repo create [<my-project>] all the plain text is required to be unchanged, but the parts in the brackets can change or be left out.
But I see where your coming from and I'm going to think about this for a bit.
There was a problem hiding this comment.
Ah I see where you're coming from too! I could go either way.
Maybe it also goes without saying that any text that is not explicitly marked with [...], <...>, or {...} has no special properties.
docs/command-line-syntax.md
Outdated
| Ellipsis represent arguments that can appear multiple times | ||
|
|
||
| _*example:*_ | ||
| `gh pr close <numbers … >` |
There was a problem hiding this comment.
The ellipsis should be outside of angled brackets
| `gh pr close <numbers … >` | |
| `gh pr close <number>...` |
There was a problem hiding this comment.
This is one where I had trouble. Google's example of using ellipsis looks like this.
gcloud dns group [global-flag ...]
IBM has a cli document that shows ellipsis inside [] but outside {}. That kind of makes sense because {} is treated like a set, so the set is repeating.
So based on the docs and examples I see it looks like it goes inside angled brackets. Do you have examples of ellipses in existing cli apps we can look at?
There was a problem hiding this comment.
Inspecting the HTML source of google's document reveals ellipsis was outside of the placeholder:
<code>
gcloud dns
<var>group</var>
[<var>global-flag</var> ...]
</code>The cat(1) manual says:
cat [<OPTION>]... [<FILE>]...
git-rev-parse(1) says:
git rev-parse [<options>] <args>...
AWS CLI says:
aws s3 <Command> [<Arg> ...]
The thing I noticed was their examples for placeholder text. The doc says |
I see! I've interpreted that to be due to their HTML rendering of the documentation. All instances of |
|
I've made some additional changes to this. Let me know what you think. |
|
Updated thoughts after sitting on this for a bit:
|
I think this makes sense.
I'm behind this stance as well
This hasn't passed the threshold for me yet (but it is right on the line.) I'm leaning towards listing out the three examples right now because it still feels readable to me.
Yes, I'll add this. |
mislav
left a comment
There was a problem hiding this comment.
Thank you for the updates!
🚀🌔
Here is my first pass at some documentation for how we use this.
Questions:
References:
google - pretty thorough, but doesn't follow the standards we've been using
microsoft - very simple, but matches what we have
ibm - like microsoft's but with more examples