jiri: Pass global and ancestor flags to external subcommands.
Updates the cmdline package to automatically pass through flags
set anywhere on the command line to external child commands.
This ensures that commands like "jiri -n go install all" pass the
-n flag through to jiri-go when it is invoked.
Also updated the semantics of setting cmdline.Command.Flags.
Previously if you defined a flag F on a command C, we'd only
allow parsing of F on the command line immediately after C. Now
we allow F to be specified immediately after C, or after any
descendant of C. Updated the help documentation accordingly.
Also updated documentation for help -style flag, and renamed the
"short" style to "shortonly" to make its purpose more clear.
And finally, updated the timer label "root" to the command path,
to make it easier to understand the output when -time is passed
through from jiri to its external subcommands.
Fixes https://github.com/vanadium/issues/issues/793
MultiPart: 1/4
Change-Id: I9f6c861d608451b73a676d99910b29cde2978528
diff --git a/doc.go b/doc.go
index b41ea96..40b7e29 100644
--- a/doc.go
+++ b/doc.go
@@ -42,7 +42,7 @@
Manage project changelists.
Usage:
- jiri cl <command>
+ jiri cl [flags] <command>
The jiri cl commands are:
cleanup Clean up changelists that have been merged
@@ -50,6 +50,14 @@
new Create a new local branch for a changelist
sync Bring a changelist up to date
+The jiri cl flags are:
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -v=false
+ Print verbose output.
+
Jiri cl cleanup - Clean up changelists that have been merged
Command "cleanup" checks that the given branches have been merged into the
@@ -68,6 +76,13 @@
-remote-branch=master
Name of the remote branch the CL pertains to.
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -v=false
+ Print verbose output.
+
Jiri cl mail - Mail a changelist for review
Command "mail" squashes all commits of a local branch into a single "changelist"
@@ -108,6 +123,13 @@
-verify=true
Run pre-push git hooks.
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -v=false
+ Print verbose output.
+
Jiri cl new - Create a new local branch for a changelist
Command "new" creates a new local branch for a changelist. In particular, it
@@ -118,10 +140,18 @@
commands.
Usage:
- jiri cl new <name>
+ jiri cl new [flags] <name>
<name> is the changelist name.
+The jiri cl new flags are:
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -v=false
+ Print verbose output.
+
Jiri cl sync - Bring a changelist up to date
Command "sync" brings the CL identified by the current branch up to date with
@@ -144,6 +174,13 @@
-remote-branch=master
Name of the remote branch the CL pertains to.
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -v=false
+ Print verbose output.
+
Jiri contributors - List project contributors
Lists project contributors. Projects to consider can be specified as an
@@ -161,12 +198,17 @@
-n=false
Show number of contributions.
+ -color=true
+ Use color to format output.
+ -v=false
+ Print verbose output.
+
Jiri project - Manage the jiri projects
Manage the jiri projects.
Usage:
- jiri project <command>
+ jiri project [flags] <command>
The jiri project commands are:
clean Restore jiri projects to their pristine state
@@ -174,6 +216,14 @@
shell-prompt Print a succinct status of projects suitable for shell prompts
poll Poll existing jiri projects
+The jiri project flags are:
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -v=false
+ Print verbose output.
+
Jiri project clean - Restore jiri projects to their pristine state
Restore jiri projects back to their master branches and get rid of all the local
@@ -188,6 +238,13 @@
-branches=false
Delete all non-master branches.
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -v=false
+ Print verbose output.
+
Jiri project list - List existing jiri projects and branches
Inspect the local filesystem and list the existing projects and branches.
@@ -202,6 +259,13 @@
If true, omit pristine projects, i.e. projects with a clean master branch and
no other branches.
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -v=false
+ Print verbose output.
+
Jiri project shell-prompt - Print a succinct status of projects suitable for shell prompts
Reports current branches of jiri projects (repositories) as well as an
@@ -220,6 +284,13 @@
-show-name=false
Show the name of the current repo.
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -v=false
+ Print verbose output.
+
Jiri project poll - Poll existing jiri projects
Poll jiri projects that can affect the outcome of the given tests and report
@@ -235,6 +306,13 @@
-manifest=
Name of the project manifest.
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -v=false
+ Print verbose output.
+
Jiri rebuild - Rebuild all jiri tools
Rebuilds all jiri tools and installs the resulting binaries into
@@ -245,7 +323,15 @@
Run "jiri help manifest" for details on manifests.
Usage:
- jiri rebuild
+ jiri rebuild [flags]
+
+The jiri rebuild flags are:
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -v=false
+ Print verbose output.
Jiri snapshot - Manage project snapshots
@@ -268,6 +354,13 @@
-remote=false
Manage remote snapshots.
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -v=false
+ Print verbose output.
+
Jiri snapshot create - Create a new project snapshot
The "jiri snapshot create <label>" command captures the current project state in
@@ -306,6 +399,15 @@
-time-format=2006-01-02T15:04:05Z07:00
Time format for snapshot file name.
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -remote=false
+ Manage remote snapshots.
+ -v=false
+ Print verbose output.
+
Jiri snapshot list - List existing project snapshots
The "snapshot list" command lists existing snapshots of the labels specified as
@@ -313,10 +415,20 @@
snapshots for all known labels.
Usage:
- jiri snapshot list <label ...>
+ jiri snapshot list [flags] <label ...>
<label ...> is a list of snapshot labels.
+The jiri snapshot list flags are:
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -remote=false
+ Manage remote snapshots.
+ -v=false
+ Print verbose output.
+
Jiri update - Update all jiri tools and projects
Updates all projects, builds the latest version of all tools, and installs the
@@ -338,6 +450,13 @@
-manifest=
Name of the project manifest.
+ -color=true
+ Use color to format output.
+ -n=false
+ Show what commands will run but do not execute them.
+ -v=false
+ Print verbose output.
+
Jiri help - Display help for commands or topics
Help with no args displays the usage of the parent command.
@@ -354,9 +473,10 @@
The jiri help flags are:
-style=compact
The formatting style for help output:
- compact - Good for compact cmdline output.
- full - Good for cmdline output, shows all global flags.
- godoc - Good for godoc processing.
+ compact - Good for compact cmdline output.
+ full - Good for cmdline output, shows all global flags.
+ godoc - Good for godoc processing.
+ shortonly - Only output short description.
Override the default by setting the CMDLINE_STYLE environment variable.
-width=<terminal width>
Format output to this target width in runes, or unlimited if width < 0.