public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH] #19240 - completion scripts
  2015-01-01  0:00 [PATCH] #19240 - completion scripts Ondrej Oprala
@ 2015-01-01  0:00 ` Dodji Seketeli
  0 siblings, 0 replies; 2+ messages in thread
From: Dodji Seketeli @ 2015-01-01  0:00 UTC (permalink / raw)
  To: Ondrej Oprala; +Cc: libabigail

Hello Ondrej,

Ondrej Oprala <ooprala@redhat.com> a écrit:

> Hey, I've whipped up a set of scripts for the abigail tools.
> It should be complete.

Great!

This is really cool.

> However, when an elf-file is expected,
> all regular files are completed for now.

Quite frankly, I am not concerned by this :-)

> Distcheck passes.

Cool.

I just have one minor nit:


> --- a/Makefile.am
> +++ b/Makefile.am

[...]

> +include bash-completion/Makemodule.am

I think I understand the benefits of using a scheme of non-recursive
makefiles. But right now, the project does use recursive makefile all
over the place.  If we were to use non-recursive makefiles, then I'd be
for doing it properly for the entire project, not just for one
sub-directory like in the change above.

So for now, I'd prefer that we just append the new bash-complete directory
name to the content SUBDIRS variable on the firstline of this
Makefile.am, and add a Makefile.am file in that directory, rather than a
Makemodule.am file.

The configure.ac file will also have to be updated accordingly.

OK to commit with that change, thanks!

Cheers,

[...]


-- 
		Dodji

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] #19240 - completion scripts
@ 2015-01-01  0:00 Ondrej Oprala
  2015-01-01  0:00 ` Dodji Seketeli
  0 siblings, 1 reply; 2+ messages in thread
From: Ondrej Oprala @ 2015-01-01  0:00 UTC (permalink / raw)
  To: libabigail

[-- 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-20 15:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-01  0:00 [PATCH] #19240 - completion scripts Ondrej Oprala
2015-01-01  0:00 ` Dodji Seketeli

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).