usbmon-6: removed root requirement and change the human hex dump format
[barry.git] / zsh / _bjavaloader
blobd323764241c4a3b55b23434a72ca4739a262c474
1 #compdef bjavaloader
3 local ret=1
4 local state cmds
7 local _bjavaloader_commands
8 local _bjavaloader_options
9 local _bjavaloader_dir
10 local _bjavaloader_erase
11 local _bjavaloader_wipe
14 _bjavaloader_commands=(
15         'cleareventlog:Clears the handheld event log'
16         'deviceinfo:Provides information on the handheld'
17         'dir:Lists modules on the handheld'
18         'erase:Erase module from handheld'
19         'eventlog:Retrieves the handheld event log'
20         'load:Loads modules onto the handheld'
21         'logstacktraces:Dump the stack traces for all threads to the event log'
22         'resettofactory:Reset IT policy to factory defaults'
23         'save:Retrieves modules from the handheld'
24         'screenshot:Make a screenshot of handheld'
25         'settime:Sets the time on the handheld'
26         'wipe:Wipes the handheld'
29 _bjavaloader_options=(
30         '-h[Show the most relevant command line options]'
31         '-p[PIN of device to talk with]:PIN device'
32         '-P[PIN of device to talk with (optional)]:PIN device'
33         '-v[Dump protocol data during operation]'
34         '*::arg:->cmd_or_options'
37 _bjavaloader_dir=(
38         '-s[List sibling in module list]'
41 _bjavaloader_erase=(
42         '-f[Force to erase an application current running]'
45 _bjavaloader_wipe=(
46         '-a[Wipe applications only]'
47         '-i[Wipe filesystem only]'
52 declare -A opt_args
55 _arguments -C -s "$_bjavaloader_options[@]" && return 0
58 case "$state" in
59         cmd_or_options)
60                 if (( CURRENT == 1)); then
61                         _describe -t commands 'bjavaloader command' _bjavaloader_commands && ret=0
62                 else
63                         case $words[1] in
64                                 cleareventlog)
65                                         _message 'no more arguments' && ret=0
66                                 ;;
68                                 deviceinfo)
69                                         _message 'no more arguments' && ret=0
70                                 ;;
72                                 dir)
73                                         _message 'no more arguments' && ret=0
75                                         _arguments -C -A '-*' -s \
76                                                 "$_bjavaloader_dir[@]" && ret=0
77                                 ;;
79                                 erase)
80                                         _message 'modules name from the handheld'
82                                         _arguments -C -A '-*' -s \
83                                                 "$_bjavaloader_erase[@]" \
84                                                 - recur \
85                                                 '*:directory:_path_files -/' \
86                                                 - nonrecur \
87                                                 '*:COD files:_path_files -g "*.cod(-.)"' && ret=0
88                                 ;;
90                                 eventlog)
91                                         _message 'no more arguments' && ret=0
92                                 ;;
94                                 load)
95                                         _arguments -C -A '-*' -s \
96                                                 - recur \
97                                                 '*:directory:_path_files -/' \
98                                                 - nonrecur \
99                                                 '*:COD files:_path_files -g "*.cod(-.)"' && ret=0
100                                 ;;
102                                 logstacktraces)
103                                         _message 'no more arguments' && ret=0
104                                 ;;
106                                 save)
107                                         _message 'modules name from the handheld' && ret=0
108                                 ;;
110                                 screenshot)
111                                         _arguments -C -A '-*' -s \
112                                                 - recur \
113                                                 '*:directory:_path_files -/' \
114                                                 - nonrecur \
115                                                 '*:BMP files:_path_files -g "*.bmp(-.)"' && ret=0
116                                 ;;
118                                 settime)
119                                         _message 'time format [yyyy-mm-dd HH:MM:SS]' && ret=0
120                                 ;;
122                                 wipe)
123                                         _message 'no more arguments' && ret=0
125                                         _arguments -C -A '-*' -s \
126                                                 "$_bjavaloader_wipe[@]" && ret=0
127                                 ;;
128                         esac
129                 fi
130         ;;
131 esac
133 return ret