Skip to content

Commit

Permalink
bib: make --progress=auto the default
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mvo5 committed Jan 8, 2025
1 parent 1874b2e commit 287c62a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down
8 changes: 4 additions & 4 deletions bib/cmd/bootc-image-builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,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),
Expand Down Expand Up @@ -691,7 +691,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 {
Expand Down
2 changes: 1 addition & 1 deletion bib/internal/progress/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion bib/internal/progress/progress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down

0 comments on commit 287c62a

Please sign in to comment.