-
Notifications
You must be signed in to change notification settings - Fork 0
/
ax_completion.bash
58 lines (51 loc) · 2.34 KB
/
ax_completion.bash
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
_ax_completions()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
primary_opts="add_wifi airplane_mode animation_scale clear_app_data disable_audio display display_scale font_scale launch_app layout_bounds list_packages help max_bright night_mode permissions processor pull_apks reboot screenshot settings_app shared_prefs talkback uninstall_package version_name"
#remember: COMP_WORDS[0] is `ax`
# tab complete primary word in command string
if [[ ${#COMP_WORDS[@]} == 2 ]] ; then
COMPREPLY=( $(compgen -W "${primary_opts}" -- ${cur}) )
return 0
fi
# secondary tab completion for animation_scale
animation_scale_opts="off 0.5 1 1.5 2 5 10 reset"
if [[ ${#COMP_WORDS[@]} == 3 && ${COMP_WORDS[1]} == "animation_scale" ]] ; then
COMPREPLY=( $(compgen -W "${animation_scale_opts}" -- ${cur}) )
return 0
fi
# secondary tab completion for disable_audio
disable_audio_opts="voice_call system ring music alarm notification dtfm accessibility"
if [[ ${#COMP_WORDS[@]} == 3 && ${COMP_WORDS[1]} == "disable_audio" ]] ; then
COMPREPLY=( $(compgen -W "${disable_audio_opts}" -- ${cur}) )
return 0
fi
# secondary tab completion for night_mode
night_mode_opts="on off auto"
if [[ ${#COMP_WORDS[@]} == 3 && ${COMP_WORDS[1]} == "night_mode" ]] ; then
COMPREPLY=( $(compgen -W "${night_mode_opts}" -- ${cur}) )
return 0
fi
# secondary tab completion for font_scale
font_scale_opts="small default large largest"
if [[ ${#COMP_WORDS[@]} == 3 && ${COMP_WORDS[1]} == "font_scale" ]] ; then
COMPREPLY=( $(compgen -W "${font_scale_opts}" -- ${cur}) )
return 0
fi
# secondary tab completion for display_scale
display_scale_opts="small default large larger largest"
if [[ ${#COMP_WORDS[@]} == 3 && ${COMP_WORDS[1]} == "display_scale" ]] ; then
COMPREPLY=( $(compgen -W "${display_scale_opts}" -- ${cur}) )
return 0
fi
# secondary tab completion for shared_prefs
shared_prefs_opts="list remove"
if [[ ${#COMP_WORDS[@]} == 3 && ${COMP_WORDS[1]} == "shared_prefs" ]] ; then
COMPREPLY=( $(compgen -W "${shared_prefs_opts}" -- ${cur}) )
return 0
fi
}
complete -F _ax_completions ax