From 15dc0865f0b47b7f430c8c2c9fcc39b2169d0a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Wed, 1 Apr 2015 18:11:19 +0200 Subject: [PATCH] Fixed bash completion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves: rhbz#1207668 Signed-off-by: Jaroslav Škarvada --- diff --git a/Makefile b/Makefile index abda771..792ec05 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ DESTDIR = / DOCDIR = /usr/share/doc/$(NAME) PYTHON_SITELIB = /usr/lib/python2.7/site-packages TUNED_PROFILESDIR = /usr/lib/tuned -BASH_COMPLETIONS = /usr/share/bash-completion/completions/ +BASH_COMPLETIONS = /usr/share/bash-completion/completions archive: clean mkdir -p $(VERSIONED_NAME) @@ -17,8 +17,9 @@ archive: clean cp AUTHORS COPYING INSTALL README $(VERSIONED_NAME) cp tuned.py tuned.spec tuned.service tuned.tmpfiles Makefile tuned-adm.py \ - tuned.bash dbus.conf recommend.conf tuned-main.conf 00_tuned bootcmdline \ - org.tuned.gui.policy tuned-gui.py tuned-gui.glade $(VERSIONED_NAME) + tuned-adm.bash dbus.conf recommend.conf tuned-main.conf 00_tuned \ + bootcmdline org.tuned.gui.policy tuned-gui.py tuned-gui.glade \ + $(VERSIONED_NAME) cp -a doc experiments libexec man profiles systemtap tuned $(VERSIONED_NAME) tar cjf $(VERSIONED_NAME).tar.bz2 $(VERSIONED_NAME) @@ -62,8 +63,8 @@ install: cp -a profiles/* $(DESTDIR)$(TUNED_PROFILESDIR)/ install -pm 0644 recommend.conf $(DESTDIR)$(TUNED_PROFILESDIR)/recommend.conf - # Install bash completion - install -Dpm 0644 tuned.bash $(DESTDIR)$(BASH_COMPLETIONS)/tuned/tuned.bash + # bash completion + install -Dpm 0644 tuned-adm.bash $(DESTDIR)$(BASH_COMPLETIONS)/tuned-adm # log dir mkdir -p $(DESTDIR)/var/log/tuned diff --git a/tuned-adm.bash b/tuned-adm.bash new file mode 100644 index 0000000..9fc2780 --- /dev/null +++ b/tuned-adm.bash @@ -0,0 +1,19 @@ +# bash completion for tuned-adm + +_tuned_adm() +{ + local commands="active list off profile recommend" + local cur prev words cword + _init_completion || return + + if [[ "$cword" -eq 1 ]]; then + COMPREPLY=( $(compgen -W "$commands" -- "$cur" ) ) + elif [[ "$cword" -eq 2 && "$prev" == "profile" ]]; then + COMPREPLY=( $(compgen -W "$(command find /usr/lib/tuned /etc/tuned -mindepth 1 -maxdepth 1 -type d -printf "%f\n")" -- "$cur" ) ) + else + COMPREPLY=() + fi + + return 0 +} && +complete -F _tuned_adm tuned-adm diff --git a/tuned.bash b/tuned.bash deleted file mode 100644 index 8603b8f..0000000 --- a/tuned.bash +++ /dev/null @@ -1,19 +0,0 @@ -# bash completion for tuned-adm - -_tuned_adm() -{ - local commands="active list off profile recommend" - local current="${COMP_WORDS[$COMP_CWORD]}" - local previous="${COMP_WORDS[$COMP_CWORD-1]}" - - if [[ $COMP_CWORD -eq 1 ]]; then - COMPREPLY=( $(compgen -W "$commands" -- "$current" ) ) - elif [[ $COMP_CWORD -eq 2 && "$previous" == "profile" ]]; then - COMPREPLY=( $(compgen -W "$(command find /usr/lib/tuned /etc/tuned -mindepth 1 -maxdepth 1 -type d -printf "%f\n")" -- "$current" ) ) - else - COMPREPLY=() - fi - - return 0 -} && -complete -F _tuned_adm tuned-adm -- 2.1.0