2024-09-16 20:31:15 +09:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"text/tabwriter"
|
2024-09-22 00:29:36 +09:00
|
|
|
|
|
|
|
"git.ophivana.moe/cat/fortify/internal/state"
|
2024-09-16 20:31:15 +09:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2024-09-22 00:29:36 +09:00
|
|
|
stateActionEarly bool
|
2024-09-16 20:31:15 +09:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2024-09-22 00:29:36 +09:00
|
|
|
flag.BoolVar(&stateActionEarly, "state", false, "print state information of active launchers")
|
2024-09-16 20:31:15 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
// tryState is called after app initialisation
|
|
|
|
func tryState() {
|
2024-09-22 00:29:36 +09:00
|
|
|
if stateActionEarly {
|
|
|
|
var w *tabwriter.Writer
|
|
|
|
state.MustPrintLauncherStateSimpleGlobal(&w)
|
|
|
|
if w != nil {
|
|
|
|
if err := w.Flush(); err != nil {
|
|
|
|
fmt.Println("warn: error formatting output:", err)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
fmt.Println("No information available")
|
2024-09-16 20:31:15 +09:00
|
|
|
}
|
|
|
|
|
2024-09-22 00:29:36 +09:00
|
|
|
os.Exit(0)
|
|
|
|
}
|
2024-09-16 20:31:15 +09:00
|
|
|
}
|