Skip to content

Commit

Permalink
pkill: added runstate completion
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Sep 2, 2020
1 parent cee2582 commit 679b487
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions completers/pkill_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ func init() {
rootCmd.Flags().BoolP("version", "V", false, "output version information and exit")

carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"euid": carapace.ActionUsers(),
"group": carapace.ActionGroups(),
"nslist": carapace.ActionValues("ipc", "mnt", "net", "pid", "user", "uts"),
"signal": carapace.ActionKillSignals(),
"pidfile": carapace.ActionFiles(""),
"euid": carapace.ActionUsers(),
"group": carapace.ActionGroups(),
"nslist": carapace.ActionValues("ipc", "mnt", "net", "pid", "user", "uts"),
"pidfile": carapace.ActionFiles(""),
"runstates": ActionProcessStates(),
"signal": carapace.ActionKillSignals(),
})

carapace.Gen(rootCmd).PositionalAnyCompletion(
Expand All @@ -68,3 +69,17 @@ func ActionExecutables() carapace.Action {
}
})
}

func ActionProcessStates() carapace.Action {
return carapace.ActionValuesDescribed(
"D", "uninterruptible sleep (usually IO)",
"I", "Idle kernel thread",
"R", "running or runnable (on run queue)",
"S", "interruptible sleep (waiting for an event to complete)",
"T", "stopped by job control signal",
"W", "paging (not valid since the 2.6.xx kernel)",
"X", "dead (should never be seen)",
"Z", "defunct (zombie) process, terminated but not reaped by its parent",
"t", "stopped by debugger during the tracing",
)
}

0 comments on commit 679b487

Please sign in to comment.