aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2024-12-21 20:34:40 +0900
committerOphestra <cat@gensokyo.uk>2024-12-21 20:34:40 +0900
commitcb98baa19d2f9417068ddac58aa0dffad7e48c31 (patch)
treedd633e33cb016c3fafd08143cf0733e825e68003 /main.go
parent4f4c690d38ffd58854e022067f920971a8b4e3a7 (diff)
fortify: clean up ps formatting code
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'main.go')
-rw-r--r--main.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/main.go b/main.go
index 5821b3ca..e83fea00 100644
--- a/main.go
+++ b/main.go
@@ -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 {