pgrep: updated to procps-ng 4.0.5

This commit is contained in:
Saurabh Kushwah 2025-04-19 23:07:39 +05:30
parent 1d7a894ef5
commit 6d847d3c76
No known key found for this signature in database
GPG Key ID: 8E11E1DCD6CCE8D5

View File

@ -2,6 +2,7 @@ package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/env"
"github.com/carapace-sh/carapace-bin/pkg/actions/os"
"github.com/carapace-sh/carapace-bin/pkg/actions/ps"
"github.com/spf13/cobra"
@ -10,23 +11,27 @@ import (
var rootCmd = &cobra.Command{
Use: "pgrep",
Short: "look up processes based on name and other attributes",
Long: "https://linux.die.net/man/1/pgrep",
Long: "https://man7.org/linux/man-pages/man1/pgrep.1.html",
Run: func(cmd *cobra.Command, args []string) {},
}
func Execute() error {
return rootCmd.Execute()
}
func init() {
carapace.Gen(rootCmd).Standalone()
rootCmd.Flags().String("cgroup", "", "match by cgroup v2 names")
rootCmd.Flags().BoolP("count", "c", false, "count of matching processes")
rootCmd.Flags().StringP("delimiter", "d", "", "specify output delimiter")
rootCmd.Flags().String("env", "", "match on environment variable")
rootCmd.Flags().StringP("euid", "u", "", "match by effective IDs")
rootCmd.Flags().BoolP("exact", "x", false, "match exactly with the command name")
rootCmd.Flags().BoolP("full", "f", false, "use full process name to match")
rootCmd.Flags().StringP("group", "G", "", "match real group IDs")
rootCmd.Flags().BoolP("help", "h", false, "display this help and exit")
rootCmd.Flags().BoolP("ignore-ancestors", "A", false, "exclude our ancestors from results")
rootCmd.Flags().BoolP("ignore-case", "i", false, "match case insensitively")
rootCmd.Flags().BoolP("inverse", "v", false, "negates the matching")
rootCmd.Flags().BoolP("lightweight", "w", false, "list all TID")
@ -43,11 +48,13 @@ func init() {
rootCmd.Flags().StringP("pidfile", "F", "", "read PIDs from file")
rootCmd.Flags().StringP("runstates", "r", "", "match runstates")
rootCmd.Flags().StringP("session", "s", "", "match session IDs")
rootCmd.Flags().String("signal", "", "signal to send (either number or name)")
rootCmd.Flags().StringP("terminal", "t", "", "match by controlling terminal")
rootCmd.Flags().StringP("uid", "U", "", "match by real IDs")
rootCmd.Flags().BoolP("version", "V", false, "output version information and exit")
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"env": env.ActionNameValues(false).UniqueList(","),
"euid": os.ActionUsers(),
"group": os.ActionGroups().UniqueList(","),
"ns": ps.ActionProcessIds(),
@ -56,6 +63,7 @@ func init() {
"pidfile": carapace.ActionFiles(),
"runstates": ps.ActionProcessStates().UniqueList(","),
"session": os.ActionSessionIds().UniqueList(","),
"signal": ps.ActionKillSignals(),
"terminal": os.ActionTerminals().UniqueList(","),
"uid": os.ActionUsers(),
})