From 9752b0731e833c193be67b7f85d44b04084cff41 Mon Sep 17 00:00:00 2001 From: a Date: Fri, 11 Nov 2016 14:58:26 +0100 Subject: [PATCH] Add bash completion --- .gitignore | 3 ++- README.md | 2 +- extra/{zsh => bash_zsh}/_pinkybar | 1 + extra/bash_zsh/pinkybar | 40 +++++++++++++++++++++++++++++++++++++++ src/Makefail.skel | 4 ---- 5 files changed, 44 insertions(+), 6 deletions(-) rename extra/{zsh => bash_zsh}/_pinkybar (99%) create mode 100644 extra/bash_zsh/pinkybar diff --git a/.gitignore b/.gitignore index 9d96086..52847b0 100644 --- a/.gitignore +++ b/.gitignore @@ -36,7 +36,8 @@ src/Makefile.am !configure.ac !Makefile.skel !extra/FreeBSD/Makefile -!extra/zsh/_pinkybar +!extra/bash_zsh/_pinkybar +!extra/bash_zsh/pinkybar !doc/man_template.pdc !extra/Gentoo/app-admin/pinky/* !doc/Makefile diff --git a/README.md b/README.md index 095302a..c1353fe 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ The order of supplied options will dictate how, where and what system informatio | -V | --volume | The sound volume level | | -t | --time | The current time | | -a | --ipaddr | The local ip address [argument - eth0] | -| -b | --bandwitdh | The consumed internet bandwidth so far [argument - eth0] | +| -b | --bandwidth | The consumed internet bandwidth so far [argument - eth0] | | -i | --iface | The current download and upload speed [argument - eth0] | | -A | --ipmac | The NIC mac address [argument - eth0] | | -B | --ipmask | The NIC subnet mask [argument - eth0] | diff --git a/extra/zsh/_pinkybar b/extra/bash_zsh/_pinkybar similarity index 99% rename from extra/zsh/_pinkybar rename to extra/bash_zsh/_pinkybar index 871b4c4..e18eda0 100644 --- a/extra/zsh/_pinkybar +++ b/extra/bash_zsh/_pinkybar @@ -15,6 +15,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. +# zsh completion # Cross-platform supported opts: _arguments -s -S -A '-*' : \ diff --git a/extra/bash_zsh/pinkybar b/extra/bash_zsh/pinkybar new file mode 100644 index 0000000..27f2341 --- /dev/null +++ b/extra/bash_zsh/pinkybar @@ -0,0 +1,40 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. + +# bash completion + +_pinky() { + local cur + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + + opts1='-a -b -c -d -e -f -g -h -i -j -k -l -m -n -o -p -q -r -s -t -u -v -w -x -y -z' + opts2='-A -B -C -D -E -F -G -H -I -J -K -L -M -N -O -P -Q -R -S -T -U -V -W -X -Y -Z' + opts3='--mpd --mpdtrack --mpdartist --mpdalbum --cpu --coresload --cputemp --cpuspeed' + opts3+='--cpuinfo --ramperc --ramtotal --ramfree --ramshared --rambuffer --driveperc' + opts3+='--drivetemp --drivetotal --drivefree --driveavail --battery --dvdstr --statio' + opts3+='--packages --kernsys --kernode --kernrel --kernver --kernarch --kern --perl' + opts3+='--python --weather --uptime --loadavg --voltage --fans --mobo --mobotemp --time' + opts3+='--ipaddr --bandwidth --iface --ipmac --ipmask --ipcase --iplookup --drivemodel' + opts3+='--nicinfo --nicdrv --nicver --iplink --nicfw --wifiname' + + case "$cur" in + -*) COMPREPLY=( $(compgen -W "${opts1} ${opts2} ${opts3}" -- "${cur}") ) + ;; + esac + + return 0 +} +complete -F _pinky -o filenames pinkybar diff --git a/src/Makefail.skel b/src/Makefail.skel index ed69e17..04983cf 100644 --- a/src/Makefail.skel +++ b/src/Makefail.skel @@ -3,10 +3,6 @@ AM_CFLAGS = {amCF} \ bin_PROGRAMS = pinkybar -EXTRA_PROGRAMS = ncurses -ncurses_SOURCES = ncurses.c -ncurses_LDADD = -lncurses - pinkybar_LDADD = $(X_LIBS) $(ALSA_LIBS) $(MPD_LIBS) $(PCI_LIBS) $(DVD_LIBS) $(SENSORS_LIBS) $(CURL_LIBS) $(LIBNL_LZ) $(PERL_LZ) $(PYTHON_LZ) {bzdlibs} pinkybar_SOURCES = main.c \ cpu.c \ -- 2.11.0