File tree 5 files changed +74
-1
lines changed
5 files changed +74
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ man_MANS = man/scrot.1
38
38
39
39
dist_doc_DATA = AUTHORS ChangeLog CONTRIBUTING.md doc/scrot.png FAQ.md README.md TODO.md
40
40
41
- EXTRA_DIST = $(man_MANS ) autogen.sh deps.pc
41
+ EXTRA_DIST = $(man_MANS ) autogen.sh deps.pc etc/
42
42
43
43
SUBDIRS = src
44
44
Original file line number Diff line number Diff line change @@ -99,6 +99,9 @@ Debian users can install scrot from their package manager:
99
99
$ sudo apt install scrot
100
100
```
101
101
102
+ Bash and Zsh completion scripts are available in [ etc/] ( ./etc ) .
103
+ Distro packagers are encouraged to install them to the appropriate directory.
104
+
102
105
## Author ##
103
106
104
107
scrot was originally developed by Tom Gilbert.
Original file line number Diff line number Diff line change @@ -11,6 +11,17 @@ Look for any bugs reported downstream or in our github issues and fix them:
11
11
- < https://bugzilla.redhat.com/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=scrot&product=Fedora >
12
12
- < https://bugs.gentoo.org/buglist.cgi?quicksearch=scrot >
13
13
14
+ ## Shell completion improvements
15
+
16
+ - Improve the bash completion script. Currently it's quite rudimentary.
17
+ - Filter out mutually exclusive options in zsh completion. E.g if ` -b ` is
18
+ already provided then ` --border ` should no longer be considered a potential
19
+ match.
20
+ - Add some way to install zsh/bash completion scripts. Since the directory where
21
+ completion script go into can vary, we want the user to explicitly set the
22
+ installation directory. E.g via the configure script
23
+ ` ./configure --with-zsh-completion-path=... ` .
24
+
14
25
## Switch to newer Imlib2 interfaces
15
26
16
27
These will require a minimum version bump on imlib2 and so has to be done with
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ #
3
+ # Copyright 2024 NRK <[email protected] >
4
+ #
5
+ # This is free and unencumbered software released into the public domain.
6
+ # For more information, please refer to <https://unlicense.org/>
7
+
8
+ _scrot_autocomp () {
9
+ local -a _scrot_opt_list
10
+ IFS=$' \n ' _scrot_opt_list=( $( scrot --list-options=tsv) ) 2> /dev/null
11
+ local _scrot_opts=" "
12
+ for ln in " ${_scrot_opt_list[@]} " ; do
13
+ local -a tokens
14
+ IFS=$' \t ' tokens=( ${ln} )
15
+
16
+ local sopt=" ${tokens[0]} "
17
+ local lopt=" ${tokens[1]} "
18
+ # TODO: better support for flags that accept argument
19
+ # local argtype=${tokens[2]%%:*}
20
+ # local argdesc=${tokens[2]#*:}
21
+ # local desc=${tokens[3]}
22
+ _scrot_opts+=" --${lopt} "
23
+ if [[ " $sopt " = [[:alnum:]]* ]]; then
24
+ _scrot_opts+=" -${sopt} "
25
+ fi
26
+ done
27
+ printf " %s" " ${_scrot_opts% } "
28
+ }
29
+ complete -W " $( _scrot_autocomp) " scrot
Original file line number Diff line number Diff line change
1
+ #compdef scrot
2
+ #
3
+ # Copyright 2024 NRK <
[email protected] >
4
+ #
5
+ # This is free and unencumbered software released into the public domain.
6
+ # For more information, please refer to <https://unlicense.org/>
7
+
8
+ local -a args
9
+ local list=$($~words[1] --list-options=tsv) 2>/dev/null
10
+ for ln in ${(f)list}; do
11
+ IFS=$'\t' local tokens=( ${=ln} )
12
+
13
+ local sopt="${tokens[1]}"
14
+ local lopt="${tokens[2]}"
15
+ local argtype=${tokens[3]%%:*}
16
+ local argdesc=${tokens[3]#*:}
17
+ local desc="[${tokens[4]}]"
18
+
19
+ case "$argtype" in
20
+ R) desc+=":$argdesc" ;; # Required
21
+ O) sopt+="+"; lopt+="=" ;; # Optional
22
+ N) ;; # None
23
+ esac
24
+
25
+ if [[ "${sopt}" = [[:alnum:]]* ]]; then
26
+ args+=( "-${sopt}${desc}" )
27
+ fi
28
+ args+=( "--${lopt}${desc}" )
29
+ done
30
+ _arguments "${args[@]}"
You can’t perform that action at this time.
0 commit comments