feat: add completion scripts (WIP)
This commit is contained in:
parent
6bdc2578ef
commit
e2a85db4a7
|
@ -8,7 +8,7 @@
|
|||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = doc examples include src tests
|
||||
SUBDIRS = completions doc examples include src tests
|
||||
|
||||
|
||||
pkgconfig_DATA = arif.pc
|
||||
|
|
23
completions/Makefile.am
Normal file
23
completions/Makefile.am
Normal file
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
# Copyright (C) 2023 CismonX <admin@cismon.net>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty, provided the copyright notice and
|
||||
# this notice are preserved. This file is offered as-is, without any warranty.
|
||||
#
|
||||
|
||||
dist_bashcompletion_DATA =
|
||||
dist_zshcompletion_DATA =
|
||||
|
||||
|
||||
if INSTALL_BASH_COMPLETION
|
||||
|
||||
dist_bashcompletion_DATA += bash/arify
|
||||
|
||||
endif # INSTALL_BASH_COMPLETION
|
||||
|
||||
if INSTALL_ZSH_COMPLETION
|
||||
|
||||
dist_zshcompletion_DATA += zsh/_arify
|
||||
|
||||
endif # INSTALL_ZSH_COMPLETION
|
5
completions/bash/arify
Normal file
5
completions/bash/arify
Normal file
|
@ -0,0 +1,5 @@
|
|||
_arify()
|
||||
{
|
||||
}
|
||||
|
||||
complete -F _arify arify
|
1
completions/zsh/_arify
Normal file
1
completions/zsh/_arify
Normal file
|
@ -0,0 +1 @@
|
|||
#compdef arify
|
17
configure.ac
17
configure.ac
|
@ -68,6 +68,22 @@ ARIF_ARG_ENABLE([arify], [yes], [the arify command line tool], [], [
|
|||
])
|
||||
AM_CONDITIONAL([BUILD_ARIFY], [test x${enable_arify} != xno])
|
||||
|
||||
ARIF_ARG_WITHDIR([bashcompletion],
|
||||
['$(datadir)/bash-completion/completions'], [bash completion],
|
||||
[
|
||||
AS_VAR_SET([with_bashcompletiondir], [no])
|
||||
])
|
||||
AM_CONDITIONAL([INSTALL_BASH_COMPLETION],
|
||||
[test x${with_bashcompletiondir} != xno])
|
||||
|
||||
ARIF_ARG_WITHDIR([zshcompletion],
|
||||
['$(datadir)/zsh/site-functions'], [zsh completion],
|
||||
[
|
||||
AS_VAR_SET([with_zshcompletiondir], [no])
|
||||
])
|
||||
AM_CONDITIONAL([INSTALL_ZSH_COMPLETION],
|
||||
[test x${with_zshcompletiondir} != xno])
|
||||
|
||||
# -- Checks for compiler builtins and attributes --
|
||||
|
||||
ARIF_TRY_APPLY([AX_GCC_BUILTIN], [__builtin_unreachable])
|
||||
|
@ -95,6 +111,7 @@ AC_CHECK_FUNCS([atexit memchr strcasecmp])
|
|||
PKG_INSTALLDIR()
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
completions/Makefile
|
||||
doc/Makefile
|
||||
examples/Makefile
|
||||
include/Makefile
|
||||
|
|
|
@ -33,6 +33,38 @@ AC_DEFUN([ARIF_ARG_ENABLE], [
|
|||
m4_popdef([enable_var_])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl ARIF_ARG_WITHDIR(name, default-value, description, [action-if-not-given],
|
||||
dnl [action-if-with], [action-if-without])
|
||||
dnl
|
||||
dnl Provides an option to specify a custom non-standard directory where some
|
||||
dnl objects can be installed to.
|
||||
dnl
|
||||
AC_DEFUN([ARIF_ARG_WITHDIR], [
|
||||
m4_pushdef([withdir_var_], [with_]m4_translit([$1], [-+.], [___])[dir])
|
||||
AC_MSG_CHECKING(m4_normalize([for $3 directory]))
|
||||
AC_ARG_WITH([$1dir], m4_normalize([
|
||||
AS_HELP_STRING([--with-$1dir[[=$2]]], [$3 directory])
|
||||
]), [
|
||||
AS_VAR_IF(withdir_var_, [yes], [
|
||||
AS_VAR_SET(withdir_var_, [$2])
|
||||
])
|
||||
], [
|
||||
$4
|
||||
AS_VAR_IF(withdir_var_, [yes], [
|
||||
AS_VAR_SET(withdir_var_, [$2])
|
||||
])
|
||||
])
|
||||
AS_VAR_IF(withdir_var_, [no], [
|
||||
AC_MSG_RESULT([no])
|
||||
$5
|
||||
], [
|
||||
AC_SUBST([$1dir], "${withdir_var_}")
|
||||
AC_MSG_RESULT(${withdir_var_})
|
||||
$6
|
||||
])
|
||||
m4_popdef([withdir_var_])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl ARIF_CHECK_PKG(package, version, package-name, [action-if-not-given],
|
||||
|
|
Loading…
Reference in New Issue
Block a user