File: mkpasswd.bash

package info (click to toggle)
whois 5.6.6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 584 kB
  • sloc: ansic: 2,412; perl: 203; makefile: 153; sh: 109
file content (33 lines) | stat: -rw-r--r-- 548 bytes parent folder | download | duplicates (4)
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
_mkpasswd() {

	case $3 in
	--help | --version | --salt | --rounds | --password-fd | -[hVSRP])
		return 0
		;;
	--method | -m)
		COMPREPLY=($(compgen -W '$(
			LC_ALL=C "$1" --method=help 2>/dev/null |
				while read -r method _; do
					[[ $method == Available ]] ||
						printf "%s\n" "$method"
				done
			)'))
		return 0
		;;
	esac

	if [[ $2 == -* ]]; then
		COMPREPLY=($(compgen -W '
			--method
			-5
			--salt
			--rounds
			--password-fd
			--stdin
			--help
			--version
		' -- "$2"))
		return 0
	fi

} && complete -F _mkpasswd mkpasswd