This repository was archived by the owner on Sep 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bash_completion
More file actions
100 lines (91 loc) · 2.34 KB
/
.bash_completion
File metadata and controls
100 lines (91 loc) · 2.34 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
# Bash completion for edit_file, shellcheckr, and p scripts
_edit_file() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# Available options
opts="-n --no-validate -l --line -s --shellcheck -V --version -h --help"
case "${prev}" in
-l|--line)
# Complete with line numbers - just return empty to allow user input
return 0
;;
*)
case "${cur}" in
-*)
# Complete options
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
*)
# Complete filenames
COMPREPLY=( $(compgen -f -- ${cur}) )
return 0
;;
esac
;;
esac
}
_shellcheckr() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# Available options
opts="-s --severity -S --shell -o --output -h --help"
case "${prev}" in
-s|--severity)
# Complete severity levels
COMPREPLY=( $(compgen -W "style info warning error" -- ${cur}) )
return 0
;;
-S|--shell)
# Complete shell types
COMPREPLY=( $(compgen -W "bash sh dash ksh" -- ${cur}) )
return 0
;;
-o|--output)
# Complete filenames for output
COMPREPLY=( $(compgen -f -- ${cur}) )
return 0
;;
*)
case "${cur}" in
-*)
# Complete options
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
*)
# Complete shell script files
COMPREPLY=( $(compgen -f -X '!*.@(sh|bash|zsh|ksh)' -- ${cur}) )
# Also include files without extension that might be shell scripts
COMPREPLY+=( $(compgen -f -- ${cur}) )
return 0
;;
esac
;;
esac
}
_p() {
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# p is a wrapper script that passes all arguments to p.py
# Complete with Python files and any other files
case "${cur}" in
*)
# Complete filenames, prioritizing Python files
COMPREPLY=( $(compgen -f -X '!*.py' -- ${cur}) )
COMPREPLY+=( $(compgen -f -- ${cur}) )
return 0
;;
esac
}
# Register completion functions
complete -F _edit_file edit_file
complete -F _shellcheckr shellcheckr
complete -F _p p