-
Notifications
You must be signed in to change notification settings - Fork 17
/
choom.sh
39 lines (33 loc) · 1.22 KB
/
choom.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
# Automatic generated, DON'T MODIFY IT.
# @option -n --adjust <num> specify the adjust score value
# @option -p --pid[`_module_os_pid`] <num> process ID
# @flag -h --help display this help
# @flag -V --version display version
# @arg command[`_module_os_command`]
# @arg args~[`_module_os_command_args`]
. "$ARGC_COMPLETIONS_ROOT/utils/_argc_utils.sh"
_module_os_command() {
if _argc_util_has_path_prefix; then
_argc_util_comp_path
return
fi
if [[ "$ARGC_OS" == "windows" ]]; then
PATH="$(echo "$PATH" | sed 's|:[^:]*/windows/system32:|:|Ig')" compgen -c
else
compgen -c
fi
}
_module_os_command_args() {
_argc_util_comp_subcommand 0
}
_module_os_pid() {
if [[ "$ARGC_OS" == "windows" ]]; then
tasklist /nh /fo csv | gawk -F ',' '{ gsub("\"", "", $2); gsub("\"", "", $1); print $2 "\t" $1 }'
elif [[ "$ARGC_OS" == "macos" ]]; then
command ps -eo pid,comm | tail -n +2 | gawk '{split($2, arr, "/"); print $1 "\t" arr[length(arr)]}'
else
command ps -eo pid,comm | tail -n +2 | sed -e 's/^ \+//' -e 's/ /\t/'
fi
}
command eval "$(argc --argc-eval "$0" "$@")"