diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-09-12 21:07:05 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-09-12 21:07:05 +0900 |
| commit | da6d238d8a15fa583b384b547decbddcda28ff8b (patch) | |
| tree | e0f8b1364fa09e5a5ec7a1d0e86d13c475cde3eb /internal/app/run.go | |
| parent | b0aff891661dfa2f438a7264607a4e6e9caef026 (diff) | |
verbose: remove system package interaction
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/app/run.go')
| -rw-r--r-- | internal/app/run.go | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/internal/app/run.go b/internal/app/run.go index 0871e899..53548d74 100644 --- a/internal/app/run.go +++ b/internal/app/run.go @@ -10,6 +10,7 @@ import ( "git.ophivana.moe/cat/fortify/internal/state" "git.ophivana.moe/cat/fortify/internal/system" "git.ophivana.moe/cat/fortify/internal/util" + "git.ophivana.moe/cat/fortify/internal/verbose" ) const ( @@ -48,9 +49,7 @@ func (a *App) Run() { cmd.Stderr = os.Stderr cmd.Dir = system.V.RunDir - if system.V.Verbose { - fmt.Println("Executing:", cmd) - } + verbose.Println("Executing:", cmd) if err := cmd.Start(); err != nil { state.Fatal("Error starting process:", err) @@ -71,9 +70,7 @@ func (a *App) Run() { } } - if system.V.Verbose { - fmt.Println("Process exited with exit code", r) - } + verbose.Println("Process exited with exit code", r) state.BeforeExit() os.Exit(r) } @@ -86,9 +83,7 @@ func (a *App) commandBuilderSudo() (args []string) { // -A? if _, ok := os.LookupEnv(sudoAskPass); ok { - if system.V.Verbose { - fmt.Printf("%s set, adding askpass flag\n", sudoAskPass) - } + verbose.Printf("%s set, adding askpass flag\n", sudoAskPass) args = append(args, "-A") } @@ -115,7 +110,7 @@ func (a *App) commandBuilderMachineCtl() (args []string) { args = append(args, "shell", "--uid="+a.Username) // --quiet - if !system.V.Verbose { + if !verbose.Get() { args = append(args, "--quiet") } |
