-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bash-completion for augtool, augmatch, augprint (#783)
Co-authored-by: George Hansper <[email protected]>
- Loading branch information
1 parent
187de8b
commit 564c5bf
Showing
6 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,7 @@ rm -rf $RPM_BUILD_ROOT | |
%doc %{_mandir}/man1/* | ||
%{_datadir}/vim/vimfiles/syntax/augeas.vim | ||
%{_datadir}/vim/vimfiles/ftdetect/augeas.vim | ||
%{bash_completions_dir}/*-completion.bash | ||
|
||
%files libs | ||
%defattr(-,root,root,-) | ||
|
@@ -126,6 +127,9 @@ rm -rf $RPM_BUILD_ROOT | |
%{_libdir}/libfa.a | ||
|
||
%changelog | ||
* Sun Nov 20 2022 George Hansper <[email protected]> - 1.14.0 | ||
- add bash completions | ||
|
||
* Fri Mar 17 2017 David Lutterkort <[email protected]> - 1.8.0-1 | ||
- add static subpackage | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# bash completion for augtool -*- shell-script -*- | ||
|
||
_augmatch() | ||
{ | ||
local cur prev words cword | ||
_init_completion || return | ||
|
||
case $prev in | ||
--help | -!(-*)[h]) | ||
return | ||
;; | ||
--lens | -!(-*)[l]) | ||
local lenses | ||
lenses="$(augtool --noload 'match /augeas/load/*/lens' | sed -e 's/.*@//')" | ||
COMPREPLY=($(compgen -W "${lenses,,}" -- "${cur,,}")) | ||
return | ||
;; | ||
--root | --include | -!(-*)[rI]) | ||
_filedir -d | ||
return | ||
;; | ||
esac | ||
|
||
if [[ "$cur" == -* ]]; then | ||
local opts="$(_parse_help "$1")" | ||
COMPREPLY=($(compgen -W '${opts:-$(_parse_help "$1")}' -- "$cur")) | ||
else | ||
_filedir | ||
fi | ||
} && | ||
complete -F _augmatch augmatch | ||
|
||
# ex: filetype=sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# bash completion for augtool -*- shell-script -*- | ||
|
||
_augprint() | ||
{ | ||
local cur prev words cword | ||
_init_completion || return | ||
|
||
case $prev in | ||
--help | --version | -!(-*)[hV]) | ||
return | ||
;; | ||
--target | -!(-*)[t]) | ||
_filedir | ||
return | ||
;; | ||
--lens | -!(-*)[l]) | ||
local lenses | ||
lenses="$(augtool --noload 'match /augeas/load/*/lens' | sed -e 's/.*@//')" | ||
COMPREPLY=($(compgen -W "${lenses,,}" -- "${cur,,}")) | ||
return | ||
;; | ||
esac | ||
|
||
if [[ "$cur" == -* ]]; then | ||
local opts="$(_parse_help "$1")" | ||
COMPREPLY=($(compgen -W '${opts:-$(_parse_help "$1")}' -- "$cur")) | ||
else | ||
_filedir | ||
fi | ||
} && | ||
complete -F _augprint augprint | ||
|
||
# ex: filetype=sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# bash completion for augtool -*- shell-script -*- | ||
|
||
_augtool() | ||
{ | ||
local cur prev words cword | ||
_init_completion || return | ||
|
||
case $prev in | ||
--help | --version | -!(-*)[hV]) | ||
return | ||
;; | ||
--load-file | --file | -!(-*)[lf]) | ||
_filedir | ||
return | ||
;; | ||
--root | --include | -!(-*)[rI]) | ||
_filedir -d | ||
return | ||
;; | ||
esac | ||
|
||
if [[ "$cur" == -* ]]; then | ||
local opts="$(_parse_help "$1")" | ||
COMPREPLY=($(compgen -W '${opts:-$(_parse_help "$1")}' -- "$cur")) | ||
fi | ||
} && | ||
complete -F _augtool augtool | ||
|
||
# ex: filetype=sh |