Skip to content

Removed focussed option and simplified zsh completion #415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ EXTRA_DIST = $(man_MANS) autogen.sh deps.pc etc

SUBDIRS = src

if BASH
bashcompletiondir = @bash_completion_dir@
bashcompletion_DATA = etc/bash-completion/scrot
endif

if ZSH
zshcompletiondir = @zsh_completion_dir@
zshcompletion_DATA = etc/zsh-completion/_scrot
endif

distclean-local:
-rm -rf autom4te.cache/

Expand Down
20 changes: 20 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ AC_PROG_MAKE_SET

AM_MAINTAINER_MODE

# Install bash completion script
AC_ARG_WITH([bash-completion-path],
[AS_HELP_STRING([--with-bash-completion-path=DIR],
[Custom installation directory for the bash completion script (Default=/usr/share/bash-completion/completions)])],
[bash_completion_dir="$withval"],
[bash_completion_dir="/usr/share/bash-completion/completions"])

# Install zsh completion script
AC_ARG_WITH([zsh-completion-path],
[AS_HELP_STRING([--with-zsh-completion-path=DIR],
[Custom installation directory for the zsh completion script (Default=/usr/share/zsh/site-functions)])],
[zsh_completion_dir="$withval"],
[zsh_completion_dir="/usr/share/zsh/site-functions"])

m4_pattern_forbid([^AX_],[=> GNU autoconf-archive not present. <=])
AS_IF([test "x$orig_CFLAGS" = "x"], [
CFLAGS=""
Expand Down Expand Up @@ -61,8 +75,14 @@ AS_IF([test "x$LIBBSD_NEEDED" = "xyes"], [
[AC_MSG_ERROR([BSD functions not found, libbsd is required])])
])

AM_CONDITIONAL(BASH, [test "x$bash_completion_dir" != "xno"])
AM_CONDITIONAL(ZSH, [test "x$zsh_completion_dir" != "xno"])

AC_SUBST([LIBS], ["$SCROT_DEPS_LIBS $LIBBSD_LIBS $LIBS"])
AC_SUBST([CPPFLAGS], ["$SCROT_DEPS_CFLAGS $LIBBSD_CFLAGS $CPPFLAGS"])

AC_SUBST([bash_completion_dir])
AC_SUBST([zsh_completion_dir])

AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT
11 changes: 9 additions & 2 deletions etc/zsh-completion/_scrot
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ for ln in ${(f)list}; do
N) ;; # None
esac

if [[ $lopt == "focussed" ]]; then
continue
fi

if [[ "${sopt}" = [[:alnum:]]* ]]; then
args+=( "-${sopt}${desc}" )
args+=("(-${sopt} --${lopt})-${sopt}${desc}")
args+=("(-${sopt} --${lopt})--${lopt}${desc}")
else
args+=( "--${lopt}${desc}" )
fi
args+=( "--${lopt}${desc}" )

done
_arguments "${args[@]}"