Skip to content

Commit

Permalink
Add bash completion support
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-se committed May 19, 2016
1 parent 97e7ac8 commit 3861bc8
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ LDLIBS = -ldl
CFLAGS_LIB = $(filter-out -fPIE -fpie -pie,$(CFLAGS)) -fPIC
LDFLAGS_LIB = $(filter-out -fPIE -fpie -pie,$(LDFLAGS)) -fPIC

prefix ?= /usr/local
libdir ?= $(prefix)/lib
bindir ?= $(prefix)/bin
mandir ?= $(prefix)/share/man
prefix ?= /usr/local
libdir ?= $(prefix)/lib
bindir ?= $(prefix)/bin
datadir ?= ${prefix}/share
mandir ?= $(datadir)/man
bashcompletiondir ?= ${datadir}/bash-completion/completions

all: libgtk3-nocsd.so.0 gtk3-nocsd

Expand All @@ -30,6 +32,7 @@ install:
install -D -m 0644 libgtk3-nocsd.so.0 $(DESTDIR)$(libdir)/libgtk3-nocsd.so.0
install -D -m 0755 gtk3-nocsd $(DESTDIR)$(bindir)/gtk3-nocsd
install -D -m 0644 gtk3-nocsd.1 $(DESTDIR)$(mandir)/man1/gtk3-nocsd.1
install -D -m 0644 gtk3-nocsd.bash-completion $(DESTDIR)$(bashcompletiondir)/gtk3-nocsd

check: libgtk3-nocsd.so.0 testlibs/stamp test-static-tls
@echo "RUNNING: test-static-tls"
Expand Down
34 changes: 34 additions & 0 deletions gtk3-nocsd.bash-completion
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# gtk3-nocsd bash completion module
#
# Copyright (C) 2014 Hong Jen Yee (PCMan) <[email protected]>
#
# http://lxqt.org/
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

_gtk3_nocsd() {
local cur=${COMP_WORDS[COMP_CWORD]}
local OPTS='-h --help'
for (( i=1; i <= COMP_CWORD; i++ )); do
if [[ ${COMP_WORDS[i]} != -* ]]; then
local command=${COMP_WORDS[i]}
_command_offset $i
return
fi
done
COMPREPLY=( $(compgen -W "$OPTS" -- "$cur") )
return 0
}
complete -F _gtk3_nocsd gtk3-nocsd

0 comments on commit 3861bc8

Please sign in to comment.