Skip to content

Commit

Permalink
image-builder: list --output renamed to --format
Browse files Browse the repository at this point in the history
Rename the named argument for consistency with other arguments.

Signed-off-by: Simon de Vlieger <[email protected]>
  • Loading branch information
supakeen committed Jan 29, 2025
1 parent 71cd1e5 commit b4009a2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cmd/image-builder/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/osbuild/images/pkg/imagefilter"
)

func listImages(dataDir, output string, filterExprs []string) error {
func listImages(dataDir, format string, filterExprs []string) error {
imageFilter, err := newImageFilterDefault(dataDir)
if err != nil {
return err
Expand All @@ -15,7 +15,7 @@ func listImages(dataDir, output string, filterExprs []string) error {
return err
}

fmter, err := imagefilter.NewResultsFormatter(imagefilter.OutputFormat(output))
fmter, err := imagefilter.NewResultsFormatter(imagefilter.OutputFormat(format))
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/image-builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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
}
Expand All @@ -42,7 +42,7 @@ func cmdListImages(cmd *cobra.Command, args []string) error {
return err
}

return listImages(defsDir, output, filter)
return listImages(defsDir, format, filter)
}

func ostreeImageOptions(cmd *cobra.Command) (*ostree.ImageOptions, error) {
Expand Down Expand Up @@ -230,7 +230,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{
Expand Down
2 changes: 1 addition & 1 deletion cmd/image-builder/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,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
Expand Down

0 comments on commit b4009a2

Please sign in to comment.