Ophestra Umiker
65af1684e3
All checks were successful
test / test (push) Successful in 14s
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
37 lines
689 B
Go
37 lines
689 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
"text/tabwriter"
|
|
|
|
"git.ophivana.moe/security/fortify/internal"
|
|
"git.ophivana.moe/security/fortify/internal/state"
|
|
)
|
|
|
|
var (
|
|
stateActionEarly bool
|
|
)
|
|
|
|
func init() {
|
|
flag.BoolVar(&stateActionEarly, "state", false, "print state information of active launchers")
|
|
}
|
|
|
|
// tryState is called after app initialisation
|
|
func tryState() {
|
|
if stateActionEarly {
|
|
var w *tabwriter.Writer
|
|
state.MustPrintLauncherStateSimpleGlobal(&w, internal.GetSC().RunDirPath)
|
|
if w != nil {
|
|
if err := w.Flush(); err != nil {
|
|
fmt.Println("warn: error formatting output:", err)
|
|
}
|
|
} else {
|
|
fmt.Println("No information available")
|
|
}
|
|
|
|
os.Exit(0)
|
|
}
|
|
}
|