Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

347 lines
11 KiB

  1. #compdef spt
  2. autoload -U is-at-least
  3. _spt() {
  4. typeset -A opt_args
  5. typeset -a _arguments_options
  6. local ret=1
  7. if is-at-least 5.2; then
  8. _arguments_options=(-s -S -C)
  9. else
  10. _arguments_options=(-s -C)
  11. fi
  12. local context curcontext="$curcontext" state line
  13. _arguments "${_arguments_options[@]}" \
  14. '-t+[Set the tick rate (milliseconds): the lower the number the higher the FPS.]' \
  15. '--tick-rate=[Set the tick rate (milliseconds): the lower the number the higher the FPS.]' \
  16. '-c+[Specify configuration file path.]' \
  17. '--config=[Specify configuration file path.]' \
  18. '--completions=[Generates completions for your preferred shell]: :(bash zsh fish power-shell elvish)' \
  19. '-h[Prints help information]' \
  20. '--help[Prints help information]' \
  21. '-V[Prints version information]' \
  22. '--version[Prints version information]' \
  23. ":: :_spt_commands" \
  24. "*::: :->spotify-tui" \
  25. && ret=0
  26. case $state in
  27. (spotify-tui)
  28. words=($line[1] "${words[@]}")
  29. (( CURRENT += 1 ))
  30. curcontext="${curcontext%:*:*}:spt-command-$line[1]:"
  31. case $line[1] in
  32. (pb)
  33. _arguments "${_arguments_options[@]}" \
  34. '-d+[Specifies the spotify device to use]' \
  35. '--device=[Specifies the spotify device to use]' \
  36. '-f+[Specifies the output format]' \
  37. '--format=[Specifies the output format]' \
  38. '--transfer=[Transfers the playback to new DEVICE]' \
  39. '-v+[Sets the volume of a device to VOLUME (1 - 100)]' \
  40. '--volume=[Sets the volume of a device to VOLUME (1 - 100)]' \
  41. '-t[Pauses/resumes the playback of a device]' \
  42. '--toggle[Pauses/resumes the playback of a device]' \
  43. '-s[Prints out the current status of a device (default)]' \
  44. '--status[Prints out the current status of a device (default)]' \
  45. '--share-track[Returns the url to the current track]' \
  46. '--share-album[Returns the url to the album of the current track]' \
  47. '--like[Likes the current song]' \
  48. '--shuffle[Toggles shuffle mode]' \
  49. '--repeat[Switches between repeat modes]' \
  50. '*-n[Jumps to the next song]' \
  51. '*--next[Jumps to the next song]' \
  52. '*-p[Jumps to the previous song]' \
  53. '*--previous[Jumps to the previous song]' \
  54. '-h[Prints help information]' \
  55. '--help[Prints help information]' \
  56. '-V[Prints version information]' \
  57. '--version[Prints version information]' \
  58. && ret=0
  59. ;;
  60. (playback)
  61. _arguments "${_arguments_options[@]}" \
  62. '-d+[Specifies the spotify device to use]' \
  63. '--device=[Specifies the spotify device to use]' \
  64. '-f+[Specifies the output format]' \
  65. '--format=[Specifies the output format]' \
  66. '--transfer=[Transfers the playback to new DEVICE]' \
  67. '-v+[Sets the volume of a device to VOLUME (1 - 100)]' \
  68. '--volume=[Sets the volume of a device to VOLUME (1 - 100)]' \
  69. '-t[Pauses/resumes the playback of a device]' \
  70. '--toggle[Pauses/resumes the playback of a device]' \
  71. '-s[Prints out the current status of a device (default)]' \
  72. '--status[Prints out the current status of a device (default)]' \
  73. '--share-track[Returns the url to the current track]' \
  74. '--share-album[Returns the url to the album of the current track]' \
  75. '--like[Likes the current song]' \
  76. '--shuffle[Toggles shuffle mode]' \
  77. '--repeat[Switches between repeat modes]' \
  78. '*-n[Jumps to the next song]' \
  79. '*--next[Jumps to the next song]' \
  80. '*-p[Jumps to the previous song]' \
  81. '*--previous[Jumps to the previous song]' \
  82. '-h[Prints help information]' \
  83. '--help[Prints help information]' \
  84. '-V[Prints version information]' \
  85. '--version[Prints version information]' \
  86. && ret=0
  87. ;;
  88. (p)
  89. _arguments "${_arguments_options[@]}" \
  90. '-d+[Specifies the spotify device to use]' \
  91. '--device=[Specifies the spotify device to use]' \
  92. '-f+[Specifies the output format]' \
  93. '--format=[Specifies the output format]' \
  94. '-u+[Plays the URI]' \
  95. '--uri=[Plays the URI]' \
  96. '-n+[Plays the first match with NAME from the specified category]' \
  97. '--name=[Plays the first match with NAME from the specified category]' \
  98. '(-b --album -a --artist -p --playlist -w --show)-q[Adds track to queue instead of playing it directly]' \
  99. '(-b --album -a --artist -p --playlist -w --show)--queue[Adds track to queue instead of playing it directly]' \
  100. '(-t --track -b --album -a --artist -w --show)-r[Plays a random track (only works with playlists)]' \
  101. '(-t --track -b --album -a --artist -w --show)--random[Plays a random track (only works with playlists)]' \
  102. '-b[Looks for an album]' \
  103. '--album[Looks for an album]' \
  104. '-a[Looks for an artist]' \
  105. '--artist[Looks for an artist]' \
  106. '-t[Looks for a track]' \
  107. '--track[Looks for a track]' \
  108. '-w[Looks for a show]' \
  109. '--show[Looks for a show]' \
  110. '-p[Looks for a playlist]' \
  111. '--playlist[Looks for a playlist]' \
  112. '-h[Prints help information]' \
  113. '--help[Prints help information]' \
  114. '-V[Prints version information]' \
  115. '--version[Prints version information]' \
  116. && ret=0
  117. ;;
  118. (play)
  119. _arguments "${_arguments_options[@]}" \
  120. '-d+[Specifies the spotify device to use]' \
  121. '--device=[Specifies the spotify device to use]' \
  122. '-f+[Specifies the output format]' \
  123. '--format=[Specifies the output format]' \
  124. '-u+[Plays the URI]' \
  125. '--uri=[Plays the URI]' \
  126. '-n+[Plays the first match with NAME from the specified category]' \
  127. '--name=[Plays the first match with NAME from the specified category]' \
  128. '(-b --album -a --artist -p --playlist -w --show)-q[Adds track to queue instead of playing it directly]' \
  129. '(-b --album -a --artist -p --playlist -w --show)--queue[Adds track to queue instead of playing it directly]' \
  130. '(-t --track -b --album -a --artist -w --show)-r[Plays a random track (only works with playlists)]' \
  131. '(-t --track -b --album -a --artist -w --show)--random[Plays a random track (only works with playlists)]' \
  132. '-b[Looks for an album]' \
  133. '--album[Looks for an album]' \
  134. '-a[Looks for an artist]' \
  135. '--artist[Looks for an artist]' \
  136. '-t[Looks for a track]' \
  137. '--track[Looks for a track]' \
  138. '-w[Looks for a show]' \
  139. '--show[Looks for a show]' \
  140. '-p[Looks for a playlist]' \
  141. '--playlist[Looks for a playlist]' \
  142. '-h[Prints help information]' \
  143. '--help[Prints help information]' \
  144. '-V[Prints version information]' \
  145. '--version[Prints version information]' \
  146. && ret=0
  147. ;;
  148. (l)
  149. _arguments "${_arguments_options[@]}" \
  150. '-f+[Specifies the output format]' \
  151. '--format=[Specifies the output format]' \
  152. '--limit=[Specifies the maximum number of results (1 - 50)]' \
  153. '-d[Lists devices]' \
  154. '--devices[Lists devices]' \
  155. '-p[Lists playlists]' \
  156. '--playlists[Lists playlists]' \
  157. '--liked[Lists liked songs]' \
  158. '-h[Prints help information]' \
  159. '--help[Prints help information]' \
  160. '-V[Prints version information]' \
  161. '--version[Prints version information]' \
  162. && ret=0
  163. ;;
  164. (list)
  165. _arguments "${_arguments_options[@]}" \
  166. '-f+[Specifies the output format]' \
  167. '--format=[Specifies the output format]' \
  168. '--limit=[Specifies the maximum number of results (1 - 50)]' \
  169. '-d[Lists devices]' \
  170. '--devices[Lists devices]' \
  171. '-p[Lists playlists]' \
  172. '--playlists[Lists playlists]' \
  173. '--liked[Lists liked songs]' \
  174. '-h[Prints help information]' \
  175. '--help[Prints help information]' \
  176. '-V[Prints version information]' \
  177. '--version[Prints version information]' \
  178. && ret=0
  179. ;;
  180. (s)
  181. _arguments "${_arguments_options[@]}" \
  182. '-f+[Specifies the output format]' \
  183. '--format=[Specifies the output format]' \
  184. '--limit=[Specifies the maximum number of results (1 - 50)]' \
  185. '-b[Looks for albums]' \
  186. '--albums[Looks for albums]' \
  187. '-a[Looks for artists]' \
  188. '--artists[Looks for artists]' \
  189. '-p[Looks for playlists]' \
  190. '--playlists[Looks for playlists]' \
  191. '-t[Looks for tracks]' \
  192. '--tracks[Looks for tracks]' \
  193. '-w[Looks for shows]' \
  194. '--shows[Looks for shows]' \
  195. '-h[Prints help information]' \
  196. '--help[Prints help information]' \
  197. '-V[Prints version information]' \
  198. '--version[Prints version information]' \
  199. ':search -- Specifies the search query:_files' \
  200. && ret=0
  201. ;;
  202. (search)
  203. _arguments "${_arguments_options[@]}" \
  204. '-f+[Specifies the output format]' \
  205. '--format=[Specifies the output format]' \
  206. '--limit=[Specifies the maximum number of results (1 - 50)]' \
  207. '-b[Looks for albums]' \
  208. '--albums[Looks for albums]' \
  209. '-a[Looks for artists]' \
  210. '--artists[Looks for artists]' \
  211. '-p[Looks for playlists]' \
  212. '--playlists[Looks for playlists]' \
  213. '-t[Looks for tracks]' \
  214. '--tracks[Looks for tracks]' \
  215. '-w[Looks for shows]' \
  216. '--shows[Looks for shows]' \
  217. '-h[Prints help information]' \
  218. '--help[Prints help information]' \
  219. '-V[Prints version information]' \
  220. '--version[Prints version information]' \
  221. ':search -- Specifies the search query:_files' \
  222. && ret=0
  223. ;;
  224. (help)
  225. _arguments "${_arguments_options[@]}" \
  226. '-h[Prints help information]' \
  227. '--help[Prints help information]' \
  228. '-V[Prints version information]' \
  229. '--version[Prints version information]' \
  230. && ret=0
  231. ;;
  232. esac
  233. ;;
  234. esac
  235. }
  236. (( $+functions[_spt_commands] )) ||
  237. _spt_commands() {
  238. local commands; commands=(
  239. "playback:Interacts with the playback of a device" \
  240. "pb:Interacts with the playback of a device" \
  241. "play:Plays a uri or another spotify item by name" \
  242. "p:Plays a uri or another spotify item by name" \
  243. "list:Lists devices, liked songs and playlists" \
  244. "l:Lists devices, liked songs and playlists" \
  245. "search:Searches for tracks, albums and more" \
  246. "s:Searches for tracks, albums and more" \
  247. "help:Prints this message or the help of the given subcommand(s)" \
  248. )
  249. _describe -t commands 'spt commands' commands "$@"
  250. }
  251. (( $+functions[_spt__help_commands] )) ||
  252. _spt__help_commands() {
  253. local commands; commands=(
  254. )
  255. _describe -t commands 'spt help commands' commands "$@"
  256. }
  257. (( $+functions[_l_commands] )) ||
  258. _l_commands() {
  259. local commands; commands=(
  260. )
  261. _describe -t commands 'l commands' commands "$@"
  262. }
  263. (( $+functions[_spt__l_commands] )) ||
  264. _spt__l_commands() {
  265. local commands; commands=(
  266. )
  267. _describe -t commands 'spt l commands' commands "$@"
  268. }
  269. (( $+functions[_spt__list_commands] )) ||
  270. _spt__list_commands() {
  271. local commands; commands=(
  272. )
  273. _describe -t commands 'spt list commands' commands "$@"
  274. }
  275. (( $+functions[_p_commands] )) ||
  276. _p_commands() {
  277. local commands; commands=(
  278. )
  279. _describe -t commands 'p commands' commands "$@"
  280. }
  281. (( $+functions[_spt__p_commands] )) ||
  282. _spt__p_commands() {
  283. local commands; commands=(
  284. )
  285. _describe -t commands 'spt p commands' commands "$@"
  286. }
  287. (( $+functions[_pb_commands] )) ||
  288. _pb_commands() {
  289. local commands; commands=(
  290. )
  291. _describe -t commands 'pb commands' commands "$@"
  292. }
  293. (( $+functions[_spt__pb_commands] )) ||
  294. _spt__pb_commands() {
  295. local commands; commands=(
  296. )
  297. _describe -t commands 'spt pb commands' commands "$@"
  298. }
  299. (( $+functions[_spt__play_commands] )) ||
  300. _spt__play_commands() {
  301. local commands; commands=(
  302. )
  303. _describe -t commands 'spt play commands' commands "$@"
  304. }
  305. (( $+functions[_spt__playback_commands] )) ||
  306. _spt__playback_commands() {
  307. local commands; commands=(
  308. )
  309. _describe -t commands 'spt playback commands' commands "$@"
  310. }
  311. (( $+functions[_s_commands] )) ||
  312. _s_commands() {
  313. local commands; commands=(
  314. )
  315. _describe -t commands 's commands' commands "$@"
  316. }
  317. (( $+functions[_spt__s_commands] )) ||
  318. _spt__s_commands() {
  319. local commands; commands=(
  320. )
  321. _describe -t commands 'spt s commands' commands "$@"
  322. }
  323. (( $+functions[_spt__search_commands] )) ||
  324. _spt__search_commands() {
  325. local commands; commands=(
  326. )
  327. _describe -t commands 'spt search commands' commands "$@"
  328. }
  329. _spt "$@"