Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pull/342'
Browse files Browse the repository at this point in the history
* origin/pull/342:
  sbctl: Fix human readable output being printed when using --json
  • Loading branch information
Foxboron committed Aug 2, 2024
2 parents 625d396 + 605f6fa commit 3aaf001
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions cmd/sbctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,6 @@ func baseFlags(cmd *cobra.Command) {
flags.BoolVar(&cmdOptions.DisableLandlock, "disable-landlock", false, "Disable landlock sandboxing")
flags.BoolVar(&cmdOptions.Debug, "debug", false, "Enable verbose debug logging")
flags.StringVarP(&cmdOptions.Config, "config", "", "", "Path to configuration file")

cmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {
if cmdOptions.JsonOutput {
logging.PrintOff()
}
if cmdOptions.QuietOutput {
logging.DisableInfo = true
}
}
}

func JsonOut(v interface{}) error {
Expand Down Expand Up @@ -134,6 +125,12 @@ func main() {

// We need to set this after we have parsed stuff
rootCmd.PersistentPreRun = func(_ *cobra.Command, _ []string) {
if cmdOptions.JsonOutput {
logging.PrintOff()
}
if cmdOptions.QuietOutput {
logging.DisableInfo = true
}
if cmdOptions.DisableLandlock {
state.Config.Landlock = false
}
Expand Down

0 comments on commit 3aaf001

Please sign in to comment.