Ophestra Umiker
6bc5be7e5a
All checks were successful
test / test (push) Successful in 19s
This change helps tests stub out and simulate OS behaviour during the sealing process. This also removes dependency on XDG_RUNTIME_DIR as the internal.System implementation provided to App provides a compat directory inside the tmpdir-based share when XDG_RUNTIME_DIR is unavailable. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
36 lines
674 B
Go
36 lines
674 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"text/tabwriter"
|
|
|
|
"git.ophivana.moe/security/fortify/internal/fmsg"
|
|
"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, os.Paths().RunDirPath)
|
|
if w != nil {
|
|
if err := w.Flush(); err != nil {
|
|
fmsg.Println("cannot format output:", err)
|
|
}
|
|
} else {
|
|
fmt.Println("No information available")
|
|
}
|
|
|
|
os.Exit(0)
|
|
}
|
|
}
|