summaryrefslogtreecommitdiff
blob: 5235e74d77353b2536f9dfc382f2d5ff3101c679 (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# $Id$
# rkhunter completion

_rkhunter() {
	local cur prev opts
	COMPREPLY=()
	cur=${COMP_WORDS[COMP_CWORD]}
	prev=${COMP_WORDS[COMP_CWORD-1]}
	opts="-c --checkall --createlogfile --cronjob --display-logfile -h --help\
		 --nocolors --report-mode --report-warnings-only \
		 --skip-application-check --skip-keypress --quick --quiet --update \
		 --version --versioncheck --bindir --configfile --dbdir --rootdir \
		 --tmpdir --disable-md5-check --disable-passwd-check \
		 --scan-knownbad-files" 

	if [[ "${cur}" == -* ]] || [[ ${COMP_CWORD} -eq 1 ]]; then
		COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
	fi

	case "${prev}" in
		--createlogfile)
			COMPREPLY=($(compgen -o filenames -A file -W "${opts/--createlogfile}" \
			    -- "${cur}"))
			;;
		--display-logfile)
			COMPREPLY=($(compgen -W "${opts/--display-logfile}" -- "${cur}"))
			;;
		--*dir)	
			COMPREPLY=($(compgen -o dirnames -A directory -- "${cur}"))
			;;
		--*file)
			COMPREPLY=($(compgen -o filenames -A file -- "${cur}"))
			;;
		-c|--checkall)
			COMPREPLY=($(compgen -W "${opts/-c --checkall}" -- "${cur}"))
			;;
		--cronjob)
			COMPREPLY=($(compgen -W "${opts/--cronjob}" -- "${cur}"))
			;;
		-h|--help)
			COMPREPLY=($(compgen -W "${opts/-h --help}" -- "${cur}"))
			;;
		--nocolors)
			COMPREPLY=($(compgen -W "${opts/--nocolors}" -- "${cur}"))
			;;
		--report-mode)
			COMPREPLY=($(compgen -W "${opts/--report-mode}" -- "${cur}"))
			;;
		--report-warnings-only)
			COMPREPLY=($(compgen -W "${opts/--report-warnings-only}" -- \
				"${cur}"))
			;;
		--skip-application-check)
			COMPREPLY=($(compgen -W "${opts/--skip-application-check}" -- \
				"${cur}"))
			;;
		--skip-keypress)
			COMPREPLY=($(compgen -W "${opts/--skip-keypress}" -- "${cur}"))
			;;
		--quick)
			COMPREPLY=($(compgen -W "${opts/--quick}" -- "${cur}"))
			;;
		--quiet)
			COMPREPLY=($(compgen -W "${opts/--quiet}" -- "${cur}"))
			;;
		--update)
			COMPREPLY=($(compgen -W "${opts/--update}" -- "${cur}"))
			;;
		--version)
			COMPREPLY=($(compgen -W "${opts/--version}" -- "${cur}"))
			;;
		--versioncheck)
			COMPREPLY=($(compgen -W "${opts/--versioncheck}" -- "${cur}"))
			;;
		--disable-md5-check)
			COMPREPLY=($(compgen -W "${opts/--disable-md5-check}" -- "${cur}"))
			;;
		--disable-passwd-check)
			COMPREPLY=($(compgen -W "${opts/--disable-passwd-check}" -- \
				"${cur}"))
			;;
		--scan-knownbad-files)
			COMPREPLY=($(compgen -W "${opts/--scan-knownbad-files}" -- \
				"${cur}"))
			;;
	esac
}
complete -F _rkhunter rkhunter