From 9242b15a972548a49da39ed4271ab31c7c12d607 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 6 Jan 2025 13:15:59 +0100 Subject: [PATCH] bib: make `--progress=auto` the default Previously an empty string in `--progress` meant to "auto-select". But that is not super intuitive so this commit makes it explicit using "auto". Thanks to Achilleas for the suggestion. --- README.md | 2 +- bib/cmd/bootc-image-builder/main.go | 8 ++++---- bib/internal/progress/progress.go | 2 +- bib/internal/progress/progress_test.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index aac4c8944..44278888f 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ Flags: | Argument | Description | Default Value | |-------------------|-----------------------------------------------------------------------------------------------------------|:-------------:| | **--chown** | chown the output directory to match the specified UID:GID | ❌ | -| **--progress** | Show progress in the given format, supported: plain,term,debug. If empty it is auto-detected | ❌ | +| **--progress** | Show progress in the given format, supported: plain,term,debug. If empty it is auto-detected | `auto` | | **--rootfs** | Root filesystem type. Overrides the default from the source container. Supported values: ext4, xfs, btrfs | ❌ | | **--tls-verify** | Require HTTPS and verify certificates when contacting registries | `true` | | **--type** | [Image type](#-image-types) to build | `qcow2` | diff --git a/bib/cmd/bootc-image-builder/main.go b/bib/cmd/bootc-image-builder/main.go index 26eca0fd5..a3305349d 100644 --- a/bib/cmd/bootc-image-builder/main.go +++ b/bib/cmd/bootc-image-builder/main.go @@ -594,9 +594,9 @@ func buildCobraCmdline() (*cobra.Command, error) { rootCmd.PersistentFlags().StringVar(&rootLogLevel, "log-level", "", "logging level (debug, info, error); default error") buildCmd := &cobra.Command{ - Use: "build IMAGE_NAME", - Short: rootCmd.Long + " (default command)", - Long: rootCmd.Long + "\n" + + Use: "build IMAGE_NAME", + Short: rootCmd.Long + " (default command)", + Long: rootCmd.Long + "\n" + "(default action if no command is given)\n" + "IMAGE_NAME: container image to build into a bootable image", Args: cobra.ExactArgs(1), @@ -646,7 +646,7 @@ func buildCobraCmdline() (*cobra.Command, error) { buildCmd.Flags().String("output", ".", "artifact output directory") buildCmd.Flags().String("store", "/store", "osbuild store for intermediate pipeline trees") //TODO: add json progress for higher level tools like "podman bootc" - buildCmd.Flags().String("progress", "", "type of progress bar to use (e.g. plain,term)") + buildCmd.Flags().String("progress", "auto", "type of progress bar to use (e.g. plain,term)") // flag rules for _, dname := range []string{"output", "store", "rpmmd"} { if err := buildCmd.MarkFlagDirname(dname); err != nil { diff --git a/bib/internal/progress/progress.go b/bib/internal/progress/progress.go index 66313078d..7468059ef 100644 --- a/bib/internal/progress/progress.go +++ b/bib/internal/progress/progress.go @@ -72,7 +72,7 @@ var isattyIsTerminal = isatty.IsTerminal // New creates a new progressbar based on the requested type func New(typ string) (ProgressBar, error) { switch typ { - case "": + case "auto": // autoselect based on if we are on an interactive // terminal, use plain progress for scripts if isattyIsTerminal(os.Stdin.Fd()) { diff --git a/bib/internal/progress/progress_test.go b/bib/internal/progress/progress_test.go index 326513f0b..4023565fb 100644 --- a/bib/internal/progress/progress_test.go +++ b/bib/internal/progress/progress_test.go @@ -125,7 +125,7 @@ func TestProgressNewAutoselect(t *testing.T) { }) defer restore() - pb, err := progress.New("") + pb, err := progress.New("auto") assert.NoError(t, err) assert.Equal(t, reflect.TypeOf(pb), reflect.TypeOf(tc.expected), fmt.Sprintf("[%v] %T not the expected %T", tc.onTerm, pb, tc.expected)) }