3. Command grammar
Source 03-command-grammar.md
<cli> <noun> <verb> [parameters]is the recommended grammar, not a requirement. A CLI may shape commands another way.- Verbs shared by all CLIs, with a fixed meaning:
list,get,search,create,update,delete,replace(whole-object replace, 6a),upsert(create or update in one command, 6a), andset-<field>(change one named field, for exampleset-status, 6a). Other verbs are allowed but have no fixed meaning. - Command and parameter names are singular. See rule 8 in 3a.
<cli> task list, not<cli> tasks list. - Named parameters over positional arguments. Order-independent. Rules for parameters are in 3a.
- Standard parameters on every CLI:
-help,-output {text,json,yaml,md},-field(repeatable),-quiet(hides warnings and human messages, never theresultor anerror),-no-input(accepted, no effect, since no command prompts, see 6),-no-color,-dry-run(mutation only),-confirm(mutation only). versionis a command, not a parameter. Every CLI has<cli> version. There is no-versionparameter (one way to ask, see 3a rule 2).- It is a query with no parameters of its own. The standard output parameters still apply.
- The
resultholdscli(the CLI’s name) andversion(the CLI’s own version, for example1.4.2). Example:{"result": {"cli": "tracker", "version": "1.4.2"}}. - In
textformat it prints one line:tracker 1.4.2. - It is unrelated to
-if-version(6a), which carries the version of a piece of data, not of the CLI.
- Standard input is chosen with the
-stdinparameter, never with a bare-as a value (see 3a). Output goes to stdout by default.