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:
parent
58aa0cf87b
commit
4d9cf723fd
3 changed files with 8 additions and 8 deletions
|
|
@ -157,11 +157,11 @@ The following filters are currently supported, shell-style globbing is supported
|
||||||
* type: the image type name (e.g. qcow2)
|
* type: the image type name (e.g. qcow2)
|
||||||
* bootmode: the bootmode (legacy, UEFI, hybrid)
|
* 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
|
```console
|
||||||
$ image-builder list-images --output=json
|
$ image-builder list-images --format=json
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"distro": {
|
"distro": {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ func cmdListImages(cmd *cobra.Command, args []string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
output, err := cmd.Flags().GetString("output")
|
format, err := cmd.Flags().GetString("format")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -50,7 +50,7 @@ func cmdListImages(cmd *cobra.Command, args []string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return listImages(dataDir, extraRepos, output, filter)
|
return listImages(dataDir, extraRepos, format, filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ostreeImageOptions(cmd *cobra.Command) (*ostree.ImageOptions, error) {
|
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,
|
Args: cobra.NoArgs,
|
||||||
}
|
}
|
||||||
listImagesCmd.Flags().StringArray("filter", nil, `Filter distributions by a specific criteria (e.g. "type:iot*")`)
|
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)
|
rootCmd.AddCommand(listImagesCmd)
|
||||||
|
|
||||||
manifestCmd := &cobra.Command{
|
manifestCmd := &cobra.Command{
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ func TestListImagesNoArguments(t *testing.T) {
|
||||||
restore := main.MockNewRepoRegistry(testrepos.New)
|
restore := main.MockNewRepoRegistry(testrepos.New)
|
||||||
defer restore()
|
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...))
|
restore = main.MockOsArgs(append([]string{"list-images"}, args...))
|
||||||
defer restore()
|
defer restore()
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ func TestListImagesNoArgsOutputJSON(t *testing.T) {
|
||||||
restore := main.MockNewRepoRegistry(testrepos.New)
|
restore := main.MockNewRepoRegistry(testrepos.New)
|
||||||
defer restore()
|
defer restore()
|
||||||
|
|
||||||
restore = main.MockOsArgs([]string{"list-images", "--output=json"})
|
restore = main.MockOsArgs([]string{"list-images", "--format=json"})
|
||||||
defer restore()
|
defer restore()
|
||||||
|
|
||||||
var fakeStdout bytes.Buffer
|
var fakeStdout bytes.Buffer
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue