-
Notifications
You must be signed in to change notification settings - Fork 264
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
chore: Reworked CLI conventions and include more details #831
chore: Reworked CLI conventions and include more details #831
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produced via:
prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github | grep -v docs/cmd/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments. Overall OK and could use some examples early on as are provided toward the end. I also think we should address:
- plurals of names. So
kn services create ...
should be OK and samekn service create ...
Likekubectl
- putting verb before resource names. So I would also be in favor of
kn create service ...
to be same askn service create ...
If there is an issue open for these, then just list the issue until resolution.
Please also address the auto markdown formatting issues. Otherwise, LGTM.
Thanks @maximilien for the feedback, highly appreciated!
This makes much sense imo and we should be more liberal here. Happy to open an issue for this
Here I'm not so sure, because of the hierarchy of command we are using. If we allow a verb as the first command, we might hit some issues:
I for myself often type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produced via:
prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github | grep -v docs/cmd/)
Co-authored-by: Navid Shaikh <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produced via:
prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github | grep -v docs/cmd/)
Co-authored-by: Navid Shaikh <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produced via:
prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github | grep -v docs/cmd/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Produced via:
prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github | grep -v docs/cmd/)
This document describes the conventions that are used for all `kn` commands and options. | ||
It is normative in the sense that any new feature that introduces or changes user-facing commands or options needs to adhere to the given principles. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format markdown:
This document describes the conventions that are used for all `kn` commands and options. | |
It is normative in the sense that any new feature that introduces or changes user-facing commands or options needs to adhere to the given principles. | |
This document describes the conventions that are used for all `kn` commands and | |
options. It is normative in the sense that any new feature that introduces or | |
changes user-facing commands or options needs to adhere to the given principles. |
Also, the given rules apply to plugins as well. | ||
Especially any plugin that wants to be promoted to the [knative/client-contrib](https://github.com/knative/client-contrib) plugin repository has to adhere to these rules. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format markdown:
Also, the given rules apply to plugins as well. | |
Especially any plugin that wants to be promoted to the [knative/client-contrib](https://github.com/knative/client-contrib) plugin repository has to adhere to these rules. | |
Also, the given rules apply to plugins as well. Especially any plugin that wants | |
to be promoted to the | |
[knative/client-contrib](https://github.com/knative/client-contrib) plugin | |
repository has to adhere to these rules. |
So, commands are generally of the form `kn <noun> <verb>` <sup>[1](#foot-1)</sup>, where [<noun>](#noun) is often the name of a resource (e.g. `service`) but can also refer to other concepts (e.g. `plugin` or `config`). | ||
This first noun forms a command group for all the operations you might want to do with that kind | ||
of resource. | ||
Sometimes there can be deeper hierarchies with multiple nouns (`kn <noun-1> <noun-2> .... <verb>`) when it makes sense to structure complex concepts. | ||
A good example is `kn source <source-type> <verb>` which is used like in `kn source ping create`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format markdown:
So, commands are generally of the form `kn <noun> <verb>` <sup>[1](#foot-1)</sup>, where [<noun>](#noun) is often the name of a resource (e.g. `service`) but can also refer to other concepts (e.g. `plugin` or `config`). | |
This first noun forms a command group for all the operations you might want to do with that kind | |
of resource. | |
Sometimes there can be deeper hierarchies with multiple nouns (`kn <noun-1> <noun-2> .... <verb>`) when it makes sense to structure complex concepts. | |
A good example is `kn source <source-type> <verb>` which is used like in `kn source ping create`. | |
So, commands are generally of the form `kn <noun> <verb>` | |
<sup>[1](#foot-1)</sup>, where [<noun>](#noun) is often the name of a resource | |
(e.g. `service`) but can also refer to other concepts (e.g. `plugin` or | |
`config`). This first noun forms a command group for all the operations you | |
might want to do with that kind of resource. Sometimes there can be deeper | |
hierarchies with multiple nouns (`kn <noun-1> <noun-2> .... <verb>`) when it | |
makes sense to structure complex concepts. A good example is | |
`kn source <source-type> <verb>` which is used like in `kn source ping create`. |
`kn` commands take only positional arguments that are used as [identifiers](#identifier). | ||
This identifier is often the name of a resource which identifies the resource uniquely for the current or given namespace. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format markdown:
`kn` commands take only positional arguments that are used as [identifiers](#identifier). | |
This identifier is often the name of a resource which identifies the resource uniquely for the current or given namespace. | |
`kn` commands take only positional arguments that are used as | |
[identifiers](#identifier). This identifier is often the name of a resource | |
which identifies the resource uniquely for the current or given namespace. |
|
||
## Verb | ||
Top-level commands concerning the operation of `kn` itself, like `help` and `version` are also okay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format markdown:
Top-level commands concerning the operation of `kn` itself, like `help` and `version` are also okay. | |
Top-level commands concerning the operation of `kn` itself, like `help` and | |
`version` are also okay. |
|
||
If the same key is given multiple times on the command line, the latter definition overwrites the previous one. | ||
|
||
Example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format markdown:
Example: | |
Example: | |
|
||
# Same as above, but the last HOME "/home" flag overwrites the previous one | ||
kn service update hello-world --env HOME=/root --env USER- --env HOME=/home | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format markdown:
``` |
Certain functionality is the same across command groups. | ||
For example, specifying resource requests and limits via flags can be done when managing services but also for sources. | ||
Those common functionalities should share the same conventions, syntax. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format markdown:
Certain functionality is the same across command groups. | |
For example, specifying resource requests and limits via flags can be done when managing services but also for sources. | |
Those common functionalities should share the same conventions, syntax. | |
Certain functionality is the same across command groups. For example, specifying | |
resource requests and limits via flags can be done when managing services but | |
also for sources. Those common functionalities should share the same | |
conventions, syntax. |
* Resource limits | ||
* Output formats, i.e. the data formats supported by the `--output` option (which is reused from k8s' _cli-runtime_) | ||
* Sinks | ||
* .... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format markdown:
* Resource limits | |
* Output formats, i.e. the data formats supported by the `--output` option (which is reused from k8s' _cli-runtime_) | |
* Sinks | |
* .... | |
- Resource limits | |
- Output formats, i.e. the data formats supported by the `--output` option | |
(which is reused from k8s' _cli-runtime_) | |
- Sinks | |
- .... |
Commands that output information should support `--output` with a shorthand of | ||
`-o` to choose how to frame their output, and `--template` for supplying | ||
templates to output styles that use them. | ||
<a name="foot-1">1</a>: Note that this differs from the `kubectl` model where this order is vice versa (`kubectl <verb> <noun>`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format markdown:
<a name="foot-1">1</a>: Note that this differs from the `kubectl` model where this order is vice versa (`kubectl <verb> <noun>`) | |
<a name="foot-1">1</a>: Note that this differs from the `kubectl` model where | |
this order is vice versa (`kubectl <verb> <noun>`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: navidshaikh, rhuss The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR tries to add some more details about the CLI conventions that we have established for the kn client. This guideline should also apply for plugin development.