]> git.ipfire.org Git - thirdparty/util-linux.git/blame - bash-completion/lslogins
fstrim: Return EXIT_FAILURE when FTRIM ioctl fails
[thirdparty/util-linux.git] / bash-completion / lslogins
CommitLineData
372221e5
SK
1_lslogins_module()
2{
3 local cur prev OPTS LSLOGINS_COLS_ALL
4 COMPREPLY=()
5 cur="${COMP_WORDS[COMP_CWORD]}"
6 prev="${COMP_WORDS[COMP_CWORD-1]}"
7 LSLOGINS_COLS_ALL="
8 USER UID GECOS HOMEDIR SHELL NOLOGIN PWD-LOCK PWD-EMPTY
9 PWD-DENY GROUP GID SUPP-GROUPS SUPP-GIDS LAST-LOGIN LAST-TTY
10 LAST-HOSTNAME FAILED-LOGIN FAILED-TTY HUSHED PWD-WARN
11 PWD-CHANGE PWD-MIN PWD-MAX PWD-EXPIR CONTEXT PROC
12 "
13 case $prev in
14 '-g'|'--groups')
15 COMPREPLY=( $(compgen -W "$(getent group | awk -F: '{print $1}')" -- $cur) )
16 return 0
17 ;;
18 '-l'|'--logins')
19 COMPREPLY=( $(compgen -W "$(getent passwd | awk -F: '{print $1}')" -- $cur) )
20 return 0
21 ;;
22 '--time-format')
23 COMPREPLY=( $(compgen -W "short full iso" -- $cur) )
24 return 0
25 ;;
26 '--wtmp-file'|'--btmp-file')
27 local IFS=$'\n'
28 compopt -o filenames
29 COMPREPLY=( $(compgen -f -- $cur) )
30 return 0
31 ;;
32 '-o'|'--output')
33 local prefix realcur LSLOGINS_COLS
34 realcur="${cur##*,}"
35 prefix="${cur%$realcur}"
36 for WORD in $LSLOGINS_COLS_ALL; do
37 if ! [[ $prefix == *"$WORD"* ]]; then
38 LSLOGINS_COLS="$WORD $LSLOGINS_COLS"
39 fi
40 done
41 compopt -o nospace
42 COMPREPLY=( $(compgen -P "$prefix" -W "$LSLOGINS_COLS" -S ',' -- $realcur) )
43 return 0
44 ;;
45 '-h'|'--help'|'-V'|'--version')
46 return 0
47 ;;
48 esac
49 COMPREPLY=( $(compgen -W "
50 --acc-expiration
51 --colon-separate
52 --export
53 --failed
54 --supp-groups
55 --groups
56 --last
57 --logins
58 --newline
59 --noheadings
60 --notruncate
61 --output
62 --pwd
63 --raw
64 --system-accs
65 --time-format
66 --user-accs
67 --context
68 --print0
69 --wtmp-file
70 --btmp-file
71 --help
72 --version
73 " -- $cur) )
74 return 0
75}
76complete -F _lslogins_module lslogins