main: rename output to format

We had a chat about this and we feel that `format` is less ambiguous a
name for this argument.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
This commit is contained in:
Simon de Vlieger 2025-02-26 20:15:33 +01:00 committed by Michael Vogt
parent 58aa0cf87b
commit 4d9cf723fd
3 changed files with 8 additions and 8 deletions

View file

@ -157,11 +157,11 @@ The following filters are currently supported, shell-style globbing is supported
* type: the image type name (e.g. qcow2)
* bootmode: the bootmode (legacy, UEFI, hybrid)
### Output control
### Text control
The output can also be switched, supported are "text", "json":
The text format can also be switched, supported are "text", "json":
```console
$ image-builder list-images --output=json
$ image-builder list-images --format=json
[
{
"distro": {

View file

@ -37,7 +37,7 @@ func cmdListImages(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
output, err := cmd.Flags().GetString("output")
format, err := cmd.Flags().GetString("format")
if err != nil {
return err
}
@ -50,7 +50,7 @@ func cmdListImages(cmd *cobra.Command, args []string) error {
return err
}
return listImages(dataDir, extraRepos, output, filter)
return listImages(dataDir, extraRepos, format, filter)
}
func ostreeImageOptions(cmd *cobra.Command) (*ostree.ImageOptions, error) {
@ -343,7 +343,7 @@ operating systems like Fedora, CentOS and RHEL with easy customizations support.
Args: cobra.NoArgs,
}
listImagesCmd.Flags().StringArray("filter", nil, `Filter distributions by a specific criteria (e.g. "type:iot*")`)
listImagesCmd.Flags().String("output", "", "Output in a specific format (text, json)")
listImagesCmd.Flags().String("format", "", "Output in a specific format (text, json)")
rootCmd.AddCommand(listImagesCmd)
manifestCmd := &cobra.Command{

View file

@ -34,7 +34,7 @@ func TestListImagesNoArguments(t *testing.T) {
restore := main.MockNewRepoRegistry(testrepos.New)
defer restore()
for _, args := range [][]string{nil, []string{"--output=text"}} {
for _, args := range [][]string{nil, []string{"--format=text"}} {
restore = main.MockOsArgs(append([]string{"list-images"}, args...))
defer restore()
@ -55,7 +55,7 @@ func TestListImagesNoArgsOutputJSON(t *testing.T) {
restore := main.MockNewRepoRegistry(testrepos.New)
defer restore()
restore = main.MockOsArgs([]string{"list-images", "--output=json"})
restore = main.MockOsArgs([]string{"list-images", "--format=json"})
defer restore()
var fakeStdout bytes.Buffer