-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrava-completion.zsh
More file actions
90 lines (85 loc) · 2.95 KB
/
strava-completion.zsh
File metadata and controls
90 lines (85 loc) · 2.95 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
#compdef strava
# Zsh completion script for strava CLI
_strava() {
local -a commands
commands=(
'init:Initialize strava-cli with API credentials'
'athlete:Get authenticated athlete profile'
'stats:Get athlete statistics'
'zones:Get heart rate and power zones'
'activities:List activities'
'activity:Get activity by ID'
'streams:Get activity streams'
'laps:Get activity laps'
'azones:Get activity zones'
'comments:Get activity comments'
'kudos:Get activity kudos'
'last:Get last N activities'
'today:Get today activities'
'week:Get this week activities'
'segment:Get segment by ID'
'starred:Get starred segments'
'explore:Explore segments in area'
'efforts:Get segment efforts'
'effort:Get segment effort by ID'
'gear:Get gear by ID'
'route:Get route by ID'
'routes:List routes'
)
local -a common_opts
common_opts=(
'--raw[Output JSON to stdout]'
'--output[Output file path]:file:_files'
'--quiet[No output]'
'--pretty[Pretty print output with tables]'
'--help[Show help]'
)
_arguments -C \
'1: :->command' \
'*::arg:->args'
case $state in
command)
_describe 'strava command' commands
;;
args)
case ${words[1]} in
activity)
_arguments \
'--efforts[Include segment efforts]' \
$common_opts
;;
activities|starred|routes)
_arguments \
'--page[Page number]:page:' \
'--per-page[Items per page]:per-page:' \
$common_opts
;;
explore)
_arguments \
'--bounds[Bounds (SW_LAT,SW_LNG,NE_LAT,NE_LNG)]:bounds:' \
'--type[Activity type]:type:(running riding)' \
'--min-cat[Minimum category]:min-cat:' \
'--max-cat[Maximum category]:max-cat:' \
$common_opts
;;
efforts)
_arguments \
'--segment[Segment ID]:segment:' \
'--start[Start date]:start:' \
'--end[End date]:end:' \
'--per-page[Items per page]:per-page:' \
$common_opts
;;
streams)
_arguments \
'*:stream type:(time distance latlng altitude velocity_smooth heartrate cadence watts temp moving grade_smooth)' \
$common_opts
;;
*)
_arguments $common_opts
;;
esac
;;
esac
}
_strava "$@"