()
| 149 | } |
| 150 | |
| 151 | func newVersionCommand() *cobra.Command { |
| 152 | return &cobra.Command{ |
| 153 | Use: rootVersionKey, |
| 154 | Short: "Print the AGH version", |
| 155 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 156 | return writeCommandOutput(cmd, outputBundle{ |
| 157 | jsonValue: version.Current(), |
| 158 | human: func() (string, error) { |
| 159 | return fmt.Sprintf("agh %s", version.Current().Version), nil |
| 160 | }, |
| 161 | toon: func() (string, error) { |
| 162 | info := version.Current() |
| 163 | return renderToonObject(rootVersionKey, []string{rootVersionKey, "commit", "build_date"}, []string{ |
| 164 | info.Version, |
| 165 | info.Commit, |
| 166 | info.BuildDate, |
| 167 | }), nil |
| 168 | }, |
| 169 | }) |
| 170 | }, |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | func ExecuteContext(ctx context.Context, args []string, stdout io.Writer, stderr io.Writer) int { |
| 175 | cmd := NewRootCommand() |
no test coverage detected