From: Ondrej Oprala <ooprala@redhat.com>
To: libabigail@sourceware.org
Subject: [PATCH] #19240 - completion scripts
Date: Thu, 01 Jan 2015 00:00:00 -0000 [thread overview]
Message-ID: <5649AD86.5090707@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 201 bytes --]
Hey, I've whipped up a set of scripts for the abigail tools.
It should be complete. However, when an elf-file is expected,
all regular files are completed for now.
Distcheck passes.
Thanks,
Ondrej
[-- Attachment #2: 0001-Add-bash-completion-scripts-for-the-libabigail-tools.patch --]
[-- Type: text/x-patch, Size: 12105 bytes --]
From 8288117878a7c1fb8ad9852826666b6fc03144d6 Mon Sep 17 00:00:00 2001
From: Ondrej Oprala <ooprala@redhat.com>
Date: Sat, 14 Nov 2015 18:32:01 +0100
Subject: [PATCH] Add bash-completion scripts for the libabigail tools
* Makefile.am: include bash-completion/Makemodule.am.
* bash-completion/abicompat: New completion script.
* bash-completion/abidiff: Likewise.
* bash-completion/abidw: Likewise.
* bash-completion/abilint: Likewise.
* bash-completion/abinilint: Likewise.
* bash-completion/abipkgdiff: Likewise.
* bash-completion/abisym: Likewise.
* configure.ac: Check for the bash-completion package. Handle
the new --enable-bash-completion[=WHEN] configure option.
* manuals/libabigail-tools.rst: Mention the scripts.
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
---
Makefile.am | 5 ++++
bash-completion/abicompat | 48 ++++++++++++++++++++++++++++++
bash-completion/abidiff | 63 ++++++++++++++++++++++++++++++++++++++++
bash-completion/abidw | 49 +++++++++++++++++++++++++++++++
bash-completion/abilint | 32 ++++++++++++++++++++
bash-completion/abinilint | 21 ++++++++++++++
bash-completion/abipkgdiff | 45 ++++++++++++++++++++++++++++
bash-completion/abisym | 21 ++++++++++++++
configure.ac | 26 +++++++++++++++++
doc/manuals/libabigail-tools.rst | 2 +-
10 files changed, 311 insertions(+), 1 deletion(-)
create mode 100755 bash-completion/abicompat
create mode 100755 bash-completion/abidiff
create mode 100755 bash-completion/abidw
create mode 100755 bash-completion/abilint
create mode 100755 bash-completion/abinilint
create mode 100755 bash-completion/abipkgdiff
create mode 100755 bash-completion/abisym
diff --git a/Makefile.am b/Makefile.am
index ac1a57a..12e6587 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,6 +8,9 @@ m4data_DATA = $(srcdir)/abigail.m4
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libabigail.pc
+bashcompletiondir = $(datadir)/bash-completion/completions
+dist_bashcompletion_DATA =
+
EXTRA_DIST = \
README COPYING ChangeLog \
COPYING-LGPLV2 COPYING-LGPLV3 \
@@ -15,6 +18,8 @@ COPYING-GPLV3 gen-changelog.py \
$(headers) $(m4data_DATA) \
libabigail.pc.in
+include bash-completion/Makemodule.am
+
update-changelog:
python $(srcdir)/gen-changelog.py > $(srcdir)/ChangeLog
diff --git a/bash-completion/abicompat b/bash-completion/abicompat
new file mode 100755
index 0000000..cb4663a
--- /dev/null
+++ b/bash-completion/abicompat
@@ -0,0 +1,48 @@
+_abicompat_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '--app-debug-info-dir'|'--lib-debug-info-dir1'|'--lib-debug-info-dir2')
+ local IFS=$'\n'
+ compopt -o dirnames
+ COMPREPLY=( $(compgen -d -- $cur) )
+ return 0
+ ;;
+ '--suppressions')
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '--drop' | '--drop-fn' | '--drop-var' | '--keep' | '--keep-fn' | '--keep-var')
+ #'--{drop,keep}{,-fn,-var}')
+ COMPREPLY=( $(compgen -W "string" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ #TODO: not done, short options missing etc..
+ OPTS=" --app-debug-info-dir1
+ --help
+ --lib-debug-info-dir1
+ --lib-debug-info-dir2
+ --list-undefined-symbols
+ --no-redundant
+ --redundant
+ --show-base-names
+ --suppressions
+ --weak-mode"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _abicompat_module abicompat
diff --git a/bash-completion/abidiff b/bash-completion/abidiff
new file mode 100755
index 0000000..5a2b551
--- /dev/null
+++ b/bash-completion/abidiff
@@ -0,0 +1,63 @@
+_abidiff_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '--d1'|'--d2'|'--debug-info-dir1'|'--debug-info-dir2')
+ local IFS=$'\n'
+ compopt -o dirnames
+ COMPREPLY=( $(compgen -d -- $cur) )
+ return 0
+ ;;
+ '--suppressions'|'--suppr')
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '--drop' | '--drop-fn' | '--drop-var' | '--keep' | '--keep-fn' | '--keep-var')
+ #'--{drop,keep}{,-fn,-var}')
+ COMPREPLY=( $(compgen -W "string" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS=" --added-fns
+ --added-vars
+ --changed-fns
+ --changed-vars
+ --d1
+ --d2
+ --debug-info-dir1
+ --debug-info-dir2
+ --deleted-fns
+ --deleted-vars
+ --drop
+ --drop-fn
+ --drop-var
+ --dump-diff-tree
+ --harmless
+ --help
+ --keep
+ --keep-fn
+ --keep-var
+ --no-harmful
+ --no-linkage-name
+ --no-redundant
+ --no-unreferenced-symbols
+ --redundant
+ --stat
+ --symtabs"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _abidiff_module abidiff
diff --git a/bash-completion/abidw b/bash-completion/abidw
new file mode 100755
index 0000000..004e4e1
--- /dev/null
+++ b/bash-completion/abidw
@@ -0,0 +1,49 @@
+_abidw_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-d'|'--debug-info-dir')
+ local IFS=$'\n'
+ compopt -o dirnames
+ COMPREPLY=( $(compgen -d -- $cur) )
+ return 0
+ ;;
+ '--check-alternative-debug-info' | '--check-alternative-debug-info-base-name')
+ # TODO: perhaps limit this to ar-s and elf-s
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '--out-file')
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS=" --abidiff
+ --debug-info-dir
+ --check-alternative-debug-info
+ --check-alternative-debug-info-base-name
+ --help
+ --load-all-types
+ --no-architecture
+ --noout
+ --out-file
+ --stats"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _abidw_module abidw
diff --git a/bash-completion/abilint b/bash-completion/abilint
new file mode 100755
index 0000000..7df78d1
--- /dev/null
+++ b/bash-completion/abilint
@@ -0,0 +1,32 @@
+_abilint_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-d'|'--debug-info-dir')
+ local IFS=$'\n'
+ compopt -o dirnames
+ COMPREPLY=( $(compgen -d -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS=" --idiff
+ --debug-info-dir
+ --help
+ --noout
+ --stdin
+ --tu"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _abilint_module abilint
diff --git a/bash-completion/abinilint b/bash-completion/abinilint
new file mode 100755
index 0000000..137b839
--- /dev/null
+++ b/bash-completion/abinilint
@@ -0,0 +1,21 @@
+_abinilint_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $cur in
+ -*)
+ OPTS=" --help
+ --noout
+ --from-stdin"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _abinilint_module abinilint
diff --git a/bash-completion/abipkgdiff b/bash-completion/abipkgdiff
new file mode 100755
index 0000000..142d987
--- /dev/null
+++ b/bash-completion/abipkgdiff
@@ -0,0 +1,45 @@
+_abipkgdiff_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '--d1'|'--d2'|'--debug-info-dir1'|'--debug-info-dir2')
+ local IFS=$'\n'
+ compopt -o dirnames
+ COMPREPLY=( $(compgen -d -- $cur) )
+ return 0
+ ;;
+ '--suppressions'|'--suppr')
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS=" --d1
+ --d2
+ --debug-info-dir1
+ --debug-info-dir2
+ --dso-only
+ --help
+ --keep-tmp-files
+ --no-added-binaries
+ --no-linkage-name
+ --redundant
+ --suppr
+ --suppressions
+ --verbose"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _abipkgdiff_module abipkgdiff
diff --git a/bash-completion/abisym b/bash-completion/abisym
new file mode 100755
index 0000000..dff4986
--- /dev/null
+++ b/bash-completion/abisym
@@ -0,0 +1,21 @@
+_abisym_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $cur in
+ -*)
+ OPTS=" --help
+ --demangle
+ --no-absolute-path"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local IFS=$'\n'
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _abisym_module abisym
diff --git a/configure.ac b/configure.ac
index 236c6eb..2ef0229 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,6 +70,12 @@ AC_ARG_ENABLE(manual,
ENABLE_MANUAL=$enableval,
ENABLE_MANUAL=auto)
+AC_ARG_ENABLE([bash-completion],
+ AS_HELP_STRING([--enable-bash-completion=yes|no|auto],
+ [enable using completion files for tools]),
+ ENABLE_BASH_COMPLETION=$enableval,
+ ENABLE_BASH_COMPLETION=auto)
+
dnl *************************************************
dnl check for dependencies
dnl *************************************************
@@ -191,6 +197,25 @@ fi
AM_CONDITIONAL(ENABLE_TAR, test x$ENABLE_TAR = xyes)
+dnl Check for the bash-completion package
+if test x$ENABLE_BASH_COMPLETION = xauto -o x$ENABLE_BASH_COMPLETION = xyes; then
+ AC_CHECK_PROG(HAS_BASH_COMPLETION, bash-completion, yes, no)
+
+ if test x$ENABLE_BASH_COMPLETION = xauto; then
+ if test x$HAS_BASH_COMPLETION = xyes; then
+ ENABLE_BASH_COMPLETION=yes
+ fi
+ fi
+fi
+
+if test x$ENABLE_BASH_COMPLETION = xyes; then
+ AC_MSG_NOTICE(bash-completion support in libabigail is enabled);
+else
+ AC_MSG_NOTICE(bash-completion support in libabigail is disabled);
+fi
+
+AM_CONDITIONAL(ENABLE_BASH_COMPLETION, test x$ENABLE_BASH_COMPLETION = xyes)
+
dnl Check for dependency: libzip
LIBZIP_VERSION=0.10.1
@@ -354,6 +379,7 @@ AC_MSG_NOTICE([
Enable rpm support in abipkgdiff : ${ENABLE_RPM}
Enable deb support in abipkgdiff : ${ENABLE_DEB}
Enable GNU tar archive support in abipkgdiff : ${ENABLE_TAR}
+ Enable bash completion : ${ENABLE_BASH_COMPLETION}
Generate html apidoc : ${ENABLE_APIDOC}
Generate html manual : ${ENABLE_MANUAL}
])
diff --git a/doc/manuals/libabigail-tools.rst b/doc/manuals/libabigail-tools.rst
index ad5e90b..2f7f4c1 100644
--- a/doc/manuals/libabigail-tools.rst
+++ b/doc/manuals/libabigail-tools.rst
@@ -7,7 +7,7 @@ Overview
The upstream code repository of Libabigail contains several tools
written using the library. They are maintained and released as part
-of the project.
+of the project. All tools come with a bash-completion script.
Tools manuals
=============
--
2.4.3
next reply other threads:[~2015-11-16 10:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-01 0:00 Ondrej Oprala [this message]
2015-01-01 0:00 ` Dodji Seketeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5649AD86.5090707@redhat.com \
--to=ooprala@redhat.com \
--cc=libabigail@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).