mirror of https://github.com/containers/podman.git
Merge pull request #7646 from edsantiago/version_options
podman version and --version: fix format, exit
This commit is contained in:
commit
c8d90d00c3
|
@ -80,10 +80,6 @@ func init() {
|
|||
)
|
||||
|
||||
rootFlags(rootCmd, registry.PodmanConfig())
|
||||
|
||||
// "version" is a local flag to avoid collisions with sub-commands that use "-v"
|
||||
var dummyVersion bool
|
||||
rootCmd.Flags().BoolVarP(&dummyVersion, "version", "v", false, "Version of Podman")
|
||||
}
|
||||
|
||||
func Execute() {
|
||||
|
|
|
@ -47,12 +47,9 @@ func version(cmd *cobra.Command, args []string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = io.WriteString(os.Stdout, s)
|
||||
_, err = io.WriteString(os.Stdout, s+"\n")
|
||||
return err
|
||||
case cmd.Flag("format").Changed:
|
||||
if !strings.HasSuffix(versionFormat, "\n") {
|
||||
versionFormat += "\n"
|
||||
}
|
||||
out := formats.StdoutTemplate{Output: versions, Template: versionFormat}
|
||||
err := out.Out()
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue