mirror of
https://github.com/mtrojnar/osslsigncode.git
synced 2025-04-04 08:50:12 -05:00
Add bash completion script (#125)
This commit is contained in:
parent
357747d2fc
commit
07bf24911d
@ -14,3 +14,8 @@ bin_PROGRAMS = osslsigncode
|
|||||||
|
|
||||||
osslsigncode_SOURCES = osslsigncode.c msi.c msi.h
|
osslsigncode_SOURCES = osslsigncode.c msi.c msi.h
|
||||||
osslsigncode_LDADD = $(OPENSSL_LIBS) $(OPTIONAL_LIBCURL_LIBS)
|
osslsigncode_LDADD = $(OPENSSL_LIBS) $(OPTIONAL_LIBCURL_LIBS)
|
||||||
|
|
||||||
|
# bash completion script
|
||||||
|
AM_DISTCHECK_CONFIGURE_FLAGS = --with-bashcompdir='$$(datarootdir)/bash-completion/completions'
|
||||||
|
bashcompdir = @bashcompdir@
|
||||||
|
dist_bashcomp_DATA = osslsigncode.bash
|
||||||
|
4
NEWS.md
4
NEWS.md
@ -1,3 +1,7 @@
|
|||||||
|
# osslsigncode change log
|
||||||
|
- added bash completion script
|
||||||
|
- added CA bundle auto-detection
|
||||||
|
|
||||||
### 2.2 (2021.08.15)
|
### 2.2 (2021.08.15)
|
||||||
|
|
||||||
- CAT files support (thanks to James McKenzie)
|
- CAT files support (thanks to James McKenzie)
|
||||||
|
@ -7,6 +7,15 @@ AM_INIT_AUTOMAKE
|
|||||||
|
|
||||||
AC_CONFIG_SRCDIR([osslsigncode.c])
|
AC_CONFIG_SRCDIR([osslsigncode.c])
|
||||||
|
|
||||||
|
# bash completion support
|
||||||
|
AC_ARG_WITH([bashcompdir],
|
||||||
|
AS_HELP_STRING([--with-bashcompdir=DIR], [directory for bash completions]), ,
|
||||||
|
[PKG_CHECK_VAR([with_bashcompdir], [bash-completion], [completionsdir], ,
|
||||||
|
[with_bashcompdir="${datarootdir}/bash-completion/completions"])])
|
||||||
|
AC_MSG_CHECKING([for bashcompdir])
|
||||||
|
AC_MSG_RESULT([$with_bashcompdir])
|
||||||
|
AC_SUBST([bashcompdir], [$with_bashcompdir])
|
||||||
|
|
||||||
dnl Checks for programs.
|
dnl Checks for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_USE_SYSTEM_EXTENSIONS
|
AC_USE_SYSTEM_EXTENSIONS
|
||||||
|
76
osslsigncode.bash
Normal file
76
osslsigncode.bash
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
# bash completion for osslsigncode -*- shell-script -*-
|
||||||
|
# Copyright (C) 2021-2022 Michał Trojnara <Michal.Trojnara@stunnel.org>
|
||||||
|
# Author: Małgorzata Olszówka <Malgorzata.Olszowka@stunnel.org>
|
||||||
|
|
||||||
|
bind 'set show-all-if-ambiguous on'
|
||||||
|
bind 'set completion-ignore-case on'
|
||||||
|
COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
|
||||||
|
|
||||||
|
_comp_cmd_osslsigncode()
|
||||||
|
{
|
||||||
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
|
|
||||||
|
local commands command options timestamps rfc3161
|
||||||
|
|
||||||
|
commands="--help --version -v
|
||||||
|
sign add attach-signature extract-signature remove-signature verify"
|
||||||
|
|
||||||
|
timestamps="http://timestamp.digicert.com
|
||||||
|
http://time.certum.pl
|
||||||
|
http://timestamp.sectigo.com
|
||||||
|
http://timestamp.globalsign.com/?signature=sha2"
|
||||||
|
|
||||||
|
rfc3161="http://timestamp.digicert.com
|
||||||
|
http://time.certum.pl
|
||||||
|
http://timestamp.entrust.net/TSS/RFC3161sha2TS
|
||||||
|
http://tss.accv.es:8318/tsa
|
||||||
|
http://kstamp.keynectis.com/KSign/
|
||||||
|
http://sha256timestamp.ws.symantec.com/sha256/timestamp"
|
||||||
|
|
||||||
|
|
||||||
|
if ((cword == 1)); then
|
||||||
|
COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
|
||||||
|
else
|
||||||
|
command=${words[1]}
|
||||||
|
case $prev in
|
||||||
|
-ac | -c | -catalog | -certs | -spc | -key | -pkcs12 | -pass | \
|
||||||
|
-readpass | -pkcs11engine | -pkcs11module | -in | -out | -sigin | \
|
||||||
|
-n | -CAfile | -CRLfile | -TSA-CAfile | -TSA-CRLfile)
|
||||||
|
_filedir
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
-h | -require-leaf-hash)
|
||||||
|
COMPREPLY=($(compgen -W 'md5 sha1 sha2 sha256 sha384 sha512' \
|
||||||
|
-- "$cur"))
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
-jp)
|
||||||
|
COMPREPLY=($(compgen -W 'low medium high' -- "$cur"))
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
-t)
|
||||||
|
COMPREPLY=($(compgen -W "${timestamps}" -- "$cur"))
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
-ts)
|
||||||
|
COMPREPLY=($(compgen -W "${rfc3161}" -- "$cur"))
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
-i | -p)
|
||||||
|
_known_hosts_real -- "$cur"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ $cur == -* ]]; then
|
||||||
|
# possible options for the command
|
||||||
|
options=$(_parse_help "$1" "$command --help" 2>/dev/null)
|
||||||
|
COMPREPLY=($(compgen -W "${options}" -- ${cur}))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
} &&
|
||||||
|
complete -F _comp_cmd_osslsigncode osslsigncode
|
||||||
|
|
||||||
|
# ex: filetype=sh
|
Loading…
x
Reference in New Issue
Block a user