diff --git a/pkgs/oizys/cmd/os.go b/pkgs/oizys/cmd/os.go index 54863ec..8fe2448 100644 --- a/pkgs/oizys/cmd/os.go +++ b/pkgs/oizys/cmd/os.go @@ -10,10 +10,12 @@ import ( ) var validArgs = []string{ - "switch", "boot", "test", "build", "dry-build", "dry-activate", "edit", "repl", + "switch", "boot", "test", "build", "dry-build", + "dry-activate", "edit", "repl", "build-vm", "build-vm-with-bootloader", "list-generations", } + var osCmd = &cobra.Command{ Use: "os [subcmd]", Short: "nixos-rebuild wrapper", @@ -21,11 +23,14 @@ var osCmd = &cobra.Command{ if err := cobra.MinimumNArgs(1)(cmd, args); err != nil { return err } - // Run the custom validation logic if slices.Contains(validArgs, args[0]) { return nil } - return fmt.Errorf("unexpected arg: %s\nexpected one of:\n %s", args[0], strings.Join(validArgs, ", ")) + return fmt.Errorf( + "unexpected arg: %s\nexpected one of:\n %s", + args[0], + strings.Join(validArgs, ", "), + ) }, Run: func(cmd *cobra.Command, args []string) { subcmd := args[0] diff --git a/pkgs/oizys/cmd/root.go b/pkgs/oizys/cmd/root.go index 0061137..e599071 100644 --- a/pkgs/oizys/cmd/root.go +++ b/pkgs/oizys/cmd/root.go @@ -32,7 +32,6 @@ var ( flake string host string debug bool - verbose bool systemPath bool resetCache bool minimal bool @@ -48,7 +47,6 @@ var rootCmd = &cobra.Command{ } oizys.SetFlake(flake) oizys.SetHost(host) - oizys.SetVerbose(verbose) oizys.SetResetCache(resetCache) oizys.SetDebug(debug) }, @@ -76,7 +74,6 @@ func init() { rootCmd.CompletionOptions.HiddenDefaultCmd = true rootCmd.PersistentFlags().StringVar(&flake, "flake", "", "path to flake ($OIZYS_DIR or $HOME/oizys)") rootCmd.PersistentFlags().StringVar(&host, "host", "", "host(s) to build (current host)") - rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "show verbose output") rootCmd.PersistentFlags().BoolVar(&debug, "debug", false, "show debug output") rootCmd.PersistentFlags().BoolVar(&resetCache, "reset-cache", false, "set narinfo-cache-negative-ttl to 0") } diff --git a/pkgs/oizys/go.mod b/pkgs/oizys/go.mod index 9aaa162..082f88f 100644 --- a/pkgs/oizys/go.mod +++ b/pkgs/oizys/go.mod @@ -9,7 +9,6 @@ require ( github.com/google/go-github/v63 v63.0.0 github.com/ivanpirog/coloredcobra v1.0.1 github.com/spf13/cobra v1.8.0 - golang.org/x/term v0.21.0 ) require ( @@ -28,4 +27,5 @@ require ( github.com/spf13/pflag v1.0.5 // indirect golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/sys v0.21.0 // indirect + golang.org/x/term v0.21.0 // indirect ) diff --git a/pkgs/oizys/internal/oizys/main.go b/pkgs/oizys/internal/oizys/main.go index 24de1f9..7585b89 100644 --- a/pkgs/oizys/internal/oizys/main.go +++ b/pkgs/oizys/internal/oizys/main.go @@ -35,7 +35,6 @@ type Oizys struct { githubToken string local bool inCI bool - verbose bool systemPath bool resetCache bool debug bool @@ -101,9 +100,6 @@ func SetHost(name string) { } func GetHost() string { return o.host } -func SetVerbose(v bool) { - o.verbose = v -} func SetResetCache(reset bool) { o.resetCache = reset @@ -241,7 +237,7 @@ func NixosRebuild(subcmd string, rest ...string) { if !o.inCI { cmd.Args = append(cmd.Args, "--log-format", "multiline") } - if o.verbose { + if o.debug { cmd.Args = append(cmd.Args, "--print-build-logs") } cmd.Args = append(cmd.Args, rest...)