fortify: clean up ps formatting code
All checks were successful
Tests / Go tests (push) Successful in 38s
Nix / NixOS tests (push) Successful in 3m1s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2024-12-21 20:34:40 +09:00
parent 4f4c690d38
commit cb98baa19d
4 changed files with 85 additions and 127 deletions

16
main.go
View File

@@ -112,16 +112,14 @@ func main() {
flag.CommandLine.Usage()
fmsg.Exit(0)
case "ps": // print all state info
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")
}
set := flag.NewFlagSet("ps", flag.ExitOnError)
var short bool
set.BoolVar(&short, "short", false, "Print instance id")
// Ignore errors; set is set for ExitOnError.
_ = set.Parse(args[1:])
printPs(short)
fmsg.Exit(0)
case "show": // pretty-print app info
if len(args) != 2 {