Add Krita completions (#9903)

* feat(completions): support Krita

* feat(completions): support summary options for Krita

* feat(completions): support remaining options for Krita

* feat(completions): remove debug instructions

* feat(completions): hide completions for sizes for Krita

* feat(completions): fix Krita

* feat(changelog): mention new completion

* fix(completions): refactor Krita

* fix(completion): reformat

* feat(completion): dynamically generate workspace list

* fix(completion): refactor

* fix(completion): krita

* fix(completions): use printf
This commit is contained in:
Emily Grace Seville 2023-07-28 01:43:51 +10:00 committed by GitHub
parent 8d3885b9cb
commit 6ce2ffbbb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 0 deletions

View file

@ -39,6 +39,7 @@ Completions
- ``age`` (:issue:`9813`).
- ``age-keygen`` (:issue:`9813`).
- ``curl`` (:issue:`9863`).
- ``krita`` (:issue:`9903`).
- ``blender`` (:issue:`9905`).
- ``gimp`` (:issue:`9904`).

View file

@ -0,0 +1,43 @@
function __krita_complete_image_format
set -l previous_token (commandline -oc)[-1]
set -l current_token (commandline -t)
if test "$previous_token" = --new-image
switch $current_token
case '*,*,*'
# nothing is completed as arbitrary width and height are expected
case '*,'
printf '%s,\n' U8 U16 F16 F32 |
string replace -r '^' $current_token
case '*'
printf '%s,\n' RGBA XYZA LABA CMYKA GRAY YCbCrA
end
end
end
function __krita_list_workspaces
path basename ~/.local/share/krita/workspaces/*.kws |
path change-extension ''
end
complete -c krita -s h -l help -d 'show help'
complete -c krita -l help-all -d 'show help with Qt options'
complete -c krita -s v -l version -d 'show version'
complete -c krita -l export -d 'export file as image'
complete -c krita -l export-pdf -d 'export file as PDF'
complete -c krita -l export-sequence -d 'export animation as sequence'
complete -c krita -l export-filename -d 'exported filename' -n '__fish_seen_subcommand_from --export --export-pdf --export-sequence' -r
complete -c krita -l template -d 'open template' -r
complete -c krita -l nosplash -d 'hide splash screen'
complete -c krita -l canvasonly -d 'open with canvasonly mode'
complete -c krita -l fullscreen -d 'open with fullscreen mode'
complete -c krita -l workspace -d 'open with workspace' -a '(__krita_list_workspaces)' -x
complete -c krita -l file-layer -d 'open with file-layer' -r
complete -c krita -l resource-location -d 'open with resource' -r
complete -c krita -l new-image -d 'open with new image'
complete -c krita -a '(__krita_complete_image_format)' -x