1+ # Fish shell completion for apy
2+ # Copy this file to ~/.config/fish/completions/
3+
4+ function __fish_apy_no_subcommand
5+ set -l cmd (commandline -opc )
6+ if [ (count $cmd ) -eq 1 ]
7+ return 0
8+ end
9+ return 1
10+ end
11+
12+ function __fish_apy_using_command
13+ set -l cmd (commandline -opc )
14+ if [ (count $cmd ) -gt 1 ]
15+ if [ $argv [1] = $cmd [2] ]
16+ return 0
17+ end
18+ end
19+ return 1
20+ end
21+
22+ # Main apy command
23+ complete -f -c apy -n ' __fish_apy_no_subcommand' -l help -s h -d ' Show help'
24+ complete -f -c apy -n ' __fish_apy_no_subcommand' -l base-path -s b -d ' Set Anki base directory' -a ' (__fish_complete_directories)'
25+ complete -f -c apy -n ' __fish_apy_no_subcommand' -l profile-name -s p -d ' Specify name of Anki profile to use'
26+ complete -f -c apy -n ' __fish_apy_no_subcommand' -l version -s V -d ' Show apy version'
27+
28+ # Subcommands
29+ complete -f -c apy -n ' __fish_apy_no_subcommand' -a add -d ' Add notes interactively from terminal'
30+ complete -f -c apy -n ' __fish_apy_no_subcommand' -a add-single -d ' Add a single note from command line arguments'
31+ complete -f -c apy -n ' __fish_apy_no_subcommand' -a add-from-file -d ' Add notes from Markdown file (alias for update-from-file)'
32+ complete -f -c apy -n ' __fish_apy_no_subcommand' -a update-from-file -d ' Update existing or add new notes from Markdown file'
33+ complete -f -c apy -n ' __fish_apy_no_subcommand' -a check-media -d ' Check media'
34+ complete -f -c apy -n ' __fish_apy_no_subcommand' -a info -d ' Print some basic statistics'
35+ complete -f -c apy -n ' __fish_apy_no_subcommand' -a model -d ' Interact with the models'
36+ complete -f -c apy -n ' __fish_apy_no_subcommand' -a list -d ' Print cards that match query'
37+ complete -f -c apy -n ' __fish_apy_no_subcommand' -a review -d ' Review/Edit notes that match query'
38+ complete -f -c apy -n ' __fish_apy_no_subcommand' -a reposition -d ' Reposition new card with given CID'
39+ complete -f -c apy -n ' __fish_apy_no_subcommand' -a sync -d ' Synchronize collection with AnkiWeb'
40+ complete -f -c apy -n ' __fish_apy_no_subcommand' -a tag -d ' Add or remove tags from notes that match query'
41+ complete -f -c apy -n ' __fish_apy_no_subcommand' -a edit -d ' Edit notes that match query directly'
42+ complete -f -c apy -n ' __fish_apy_no_subcommand' -a backup -d ' Backup Anki database to specified target file'
43+
44+ # add options
45+ complete -f -c apy -n ' __fish_apy_using_command add' -l help -s h -d ' Show help'
46+ complete -f -c apy -n ' __fish_apy_using_command add' -l tags -s t -d ' Specify default tags for new cards'
47+ complete -f -c apy -n ' __fish_apy_using_command add' -l model -s m -d ' Specify default model for new cards'
48+ complete -f -c apy -n ' __fish_apy_using_command add' -l deck -s d -d ' Specify default deck for new cards'
49+
50+ # add-single options
51+ complete -f -c apy -n ' __fish_apy_using_command add-single' -l help -s h -d ' Show help'
52+ complete -f -c apy -n ' __fish_apy_using_command add-single' -l parse-markdown -s p -d ' Parse input as Markdown'
53+ complete -f -c apy -n ' __fish_apy_using_command add-single' -l preset -s s -d ' Specify a preset'
54+ complete -f -c apy -n ' __fish_apy_using_command add-single' -l tags -s t -d ' Specify default tags for new cards'
55+ complete -f -c apy -n ' __fish_apy_using_command add-single' -l model -s m -d ' Specify default model for new cards'
56+ complete -f -c apy -n ' __fish_apy_using_command add-single' -l deck -s d -d ' Specify default deck for new cards'
57+
58+ # add-from-file and update-from-file options
59+ for cmd in add-from-file update-from-file
60+ complete -f -c apy -n " __fish_apy_using_command $cmd " -l help -s h -d ' Show help'
61+ complete -f -c apy -n " __fish_apy_using_command $cmd " -l tags -s t -d ' Specify default tags for cards'
62+ complete -f -c apy -n " __fish_apy_using_command $cmd " -l deck -s d -d ' Specify default deck for cards'
63+ complete -f -c apy -n " __fish_apy_using_command $cmd " -l update-file -s u -d ' Update original file with note IDs'
64+ # File argument
65+ complete -f -c apy -n " __fish_apy_using_command $cmd " -k -a " (__fish_complete_suffix .md)"
66+ end
67+
68+ # list options
69+ complete -f -c apy -n ' __fish_apy_using_command list' -l help -s h -d ' Show help'
70+ complete -f -c apy -n ' __fish_apy_using_command list' -l show-answer -s a -d ' Display answer'
71+ complete -f -c apy -n ' __fish_apy_using_command list' -l show-model -s m -d ' Display model'
72+ complete -f -c apy -n ' __fish_apy_using_command list' -l show-cid -s c -d ' Display card ids'
73+ complete -f -c apy -n ' __fish_apy_using_command list' -l show-due -s d -d ' Display card due time in days'
74+ complete -f -c apy -n ' __fish_apy_using_command list' -l show-type -s t -d ' Display card type'
75+ complete -f -c apy -n ' __fish_apy_using_command list' -l show-ease -s e -d ' Display card ease'
76+ complete -f -c apy -n ' __fish_apy_using_command list' -l show-lapses -s l -d ' Display card number of lapses'
77+
78+ # tag options
79+ complete -f -c apy -n ' __fish_apy_using_command tag' -l help -s h -d ' Show help'
80+ complete -f -c apy -n ' __fish_apy_using_command tag' -l add-tags -s a -d ' Add specified tags to matched notes'
81+ complete -f -c apy -n ' __fish_apy_using_command tag' -l remove-tags -s r -d ' Remove specified tags from matched notes'
82+ complete -f -c apy -n ' __fish_apy_using_command tag' -l sort -by-count -s c -d ' When listing tags, sort by note count'
83+ complete -f -c apy -n ' __fish_apy_using_command tag' -l purge -s p -d ' Remove all unused tags'
84+
85+ # review options
86+ complete -f -c apy -n ' __fish_apy_using_command review' -l help -s h -d ' Show help'
87+ complete -f -c apy -n ' __fish_apy_using_command review' -l check-markdown-consistency -s m -d ' Check for Markdown consistency'
88+ complete -f -c apy -n ' __fish_apy_using_command review' -l cmc-range -s n -d ' Number of days backwards to check consistency'
89+
90+ # edit options
91+ complete -f -c apy -n ' __fish_apy_using_command edit' -l help -s h -d ' Show help'
92+ complete -f -c apy -n ' __fish_apy_using_command edit' -l force-multiple -s f -d ' Allow editing multiple notes'
93+
94+ # backup options
95+ complete -f -c apy -n ' __fish_apy_using_command backup' -l help -s h -d ' Show help'
96+ complete -f -c apy -n ' __fish_apy_using_command backup' -l include-media -s m -d ' Include media files in backup'
97+ complete -f -c apy -n ' __fish_apy_using_command backup' -l legacy -s l -d ' Support older Anki versions'
98+
99+ # model subcommands
100+ complete -f -c apy -n ' __fish_apy_using_command model' -a edit-css -d ' Edit the CSS template for the specified model'
101+ complete -f -c apy -n ' __fish_apy_using_command model' -a rename -d ' Rename model from old_name to new_name'
102+
103+ # model edit-css options
104+ complete -f -c apy -n ' __fish_apy_using_command model; and __fish_seen_subcommand_from edit-css' -l help -s h -d ' Show help'
105+ complete -f -c apy -n ' __fish_apy_using_command model; and __fish_seen_subcommand_from edit-css' -l model-name -s m -d ' Specify for which model to edit CSS template'
106+ complete -f -c apy -n ' __fish_apy_using_command model; and __fish_seen_subcommand_from edit-css' -l sync-after -s s -d ' Perform sync after any change'
0 commit comments