Skip to content
Myr

Add documentation for '--version' flag to README (#590)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Nick Miyake · committed by Albert Nigmatzianov · parent b1ec2ce · Browse files · 1 file+7 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−0 removed

  • other:+7 added−0 removed

1 file+7 added−0 removed

modified:README.md+7 added
558 unmodified lines
559cmd.SetUsageFunc(f func(*Command) error)560cmd.SetUsageTemplate(s string)561```562563## Version Flag564565Cobra adds a top-level '--version' flag if the Version field is set on the root command.566Running an application with the '--version' flag will print the version to stdout using567the version template. The template can be customized using the568`cmd.SetVersionTemplate(s string)` function.569570## PreRun and PostRun Hooks571572It is possible to run functions before or after the main `Run` function of your command. The `PersistentPreRun` and `PreRun` functions will be executed before `Run`. `PersistentPostRun` and `PostRun` will be executed after `Run`. The `Persistent*Run` functions will be inherited by children if they do not declare their own. These functions are run in the following order:573
146 unmodified lines