Skip to content

Commit

Permalink
Add completions for build-loi command
Browse files Browse the repository at this point in the history
  • Loading branch information
apasel422 committed Jun 24, 2024
1 parent 726b3b5 commit ec5bcc1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
6 changes: 5 additions & 1 deletion se/completions/bash/se
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ _se(){
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
local commands="--help --plain --version british2american build build-ids build-images build-manifest build-spine build-title build-toc clean compare-versions create-draft dec2roman extract-ebook find-mismatched-dashes find-mismatched-diacritics find-unusual-characters help hyphenate interactive-replace lint make-url-safe modernize-spelling prepare-release recompose-epub renumber-endnotes roman2dec semanticate shift-endnotes shift-illustrations split-file titlecase typogrify unicode-names version word-count xpath"
local commands="--help --plain --version british2american build build-ids build-images build-loi build-manifest build-spine build-title build-toc clean compare-versions create-draft dec2roman extract-ebook find-mismatched-dashes find-mismatched-diacritics find-unusual-characters help hyphenate interactive-replace lint make-url-safe modernize-spelling prepare-release recompose-epub renumber-endnotes roman2dec semanticate shift-endnotes shift-illustrations split-file titlecase typogrify unicode-names version word-count xpath"
if [[ $COMP_CWORD -gt 1 ]]; then
case "${COMP_WORDS[1]}" in
british2american)
Expand All @@ -27,6 +27,10 @@ _se(){
COMPREPLY+=($(compgen -W "-h --help -v --verbose" -- "${cur}"))
COMPREPLY+=($(compgen -d -X ".*" -- "${cur}"))
;;
build-loi)
COMPREPLY+=($(compgen -W "-a -d --default-link-text -h --help --prefer-alt-text" -- "${cur}"))
COMPREPLY+=($(compgen -d -X ".*" -- "${cur}"))
;;
build-manifest)
COMPREPLY+=($(compgen -W "-h --help -s --stdout" -- "${cur}"))
COMPREPLY+=($(compgen -d -X ".*" -- "${cur}"))
Expand Down
7 changes: 6 additions & 1 deletion se/completions/fish/se.fish
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function __fish_se_no_subcommand --description "Test if se has yet to be given the subcommand"
for i in (commandline -opc)
if contains -- $i british2american build build-ids build-images build-manifest build-spine build-title build-toc clean compare-versions create-draft css-select dec2roman extract-ebook find-mismatched-dashes find-mismatched-diacritics find-unusual-characters help hyphenate interactive-replace lint make-url-safe modernize-spelling prepare-release recompose-epub renumber-endnotes roman2dec semanticate shift-endnotes shift-illustrations split-file titlecase typogrify unicode-names version word-count xpath
if contains -- $i british2american build build-ids build-images build-loi build-manifest build-spine build-title build-toc clean compare-versions create-draft css-select dec2roman extract-ebook find-mismatched-dashes find-mismatched-diacritics find-unusual-characters help hyphenate interactive-replace lint make-url-safe modernize-spelling prepare-release recompose-epub renumber-endnotes roman2dec semanticate shift-endnotes shift-illustrations split-file titlecase typogrify unicode-names version word-count xpath
return 1
end
end
Expand Down Expand Up @@ -114,6 +114,11 @@ complete -c se -A -n "__fish_seen_subcommand_from prepare-release" -s r -l no-re
complete -c se -A -n "__fish_seen_subcommand_from prepare-release" -s w -l no-word-count -d "don’t calculate word count"
complete -c se -A -n "__fish_seen_subcommand_from prepare-release" -s v -l verbose -d "increase output verbosity"

complete -c se -n "__fish_se_no_subcommand" -a build-loi -d "Update the LoI file based on all <figure> elements that contain an <img>."
complete -c se -A -n "__fish_seen_subcommand_from build-loi" -s a -l prefer-alt-text -d "prefer alt text over <figcaption> for these <figure> IDs"
complete -c se -A -n "__fish_seen_subcommand_from build-loi" -s d -l default-link-text -d "link text to use if <figcaption> or alt text is absent or empty"
complete -c se -A -n "__fish_seen_subcommand_from build-loi" -s h -l help -x -d "show this help message and exit"

complete -c se -n "__fish_se_no_subcommand" -a build-manifest -d "Generate the <manifest> element for the given Standard Ebooks source directory and write it to the ebook’s metadata file."
complete -c se -A -n "__fish_seen_subcommand_from build-manifest" -s h -l help -x -d "show this help message and exit"
complete -c se -A -n "__fish_seen_subcommand_from build-manifest" -s s -l stdout -d "print to stdout instead of writing to the metadata file"
Expand Down
8 changes: 8 additions & 0 deletions se/completions/zsh/_se
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ case $state in
"build[Build an ebook from a Standard Ebook source directory.]" \
"build-ids[Change ID attributes for non-sectioning content to their expected values across the entire ebook. IDs must be globally unique and correctly referenced, and the ebook spine must be complete.]" \
"build-images[Build ebook cover and titlepage images in a Standard Ebook source directory.]" \
"build-loi[Update the LoI file based on all <figure> elements that contain an <img>.]" \
"build-manifest[Generate the <manifest> element for the given Standard Ebooks source directory and write it to the ebook’s metadata file.]" \
"build-spine[Generate the <spine> element for the given Standard Ebooks source directory and write it to the ebook’s metadata file.]" \
"build-title[Generate the title of an XHTML file based on its headings and update the file’s <title> element.]" \
Expand Down Expand Up @@ -83,6 +84,13 @@ case $state in
{-v,--verbose}'[increase output verbosity]' \
'*: :_directories'
;;
build-loi)
_arguments -s \
{-a,--prefer-alt-text}'[prefer alt text over <figcaption> for these <figure> IDs]' \
{-d,--default-link-text}'[link text to use if <figcaption> or alt text is absent or empty]' \
{-h,--help}'[show a help message and exit]' \
'*: :_directories'
;;
build-manifest)
_arguments -s \
{-h,--help}'[show a help message and exit]' \
Expand Down

0 comments on commit ec5bcc1

Please sign in to comment.