mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-02 15:41:48 +00:00
adding bash completion script for upstart
svn path=/nixpkgs/trunk/; revision=17304
This commit is contained in:
parent
34be37b51e
commit
295c76b1c1
@ -1,5 +1,8 @@
|
||||
{stdenv, fetchurl}:
|
||||
|
||||
let bashCompletion = ./upstart-bash-completion;
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "upstart-0.3.0";
|
||||
|
||||
@ -26,6 +29,11 @@ stdenv.mkDerivation {
|
||||
interfaceVersion = 1;
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
t=$out/etc/bash_completion.d
|
||||
ensureDir $t; cp ${bashCompletion} $t/upstart
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = "http://upstart.ubuntu.com/";
|
||||
description = "An event-based replacement for the /sbin/init daemon";
|
||||
|
18
pkgs/os-specific/linux/upstart/upstart-bash-completion
Normal file
18
pkgs/os-specific/linux/upstart/upstart-bash-completion
Normal file
@ -0,0 +1,18 @@
|
||||
_upstart_comp_list(){
|
||||
COMPREPLY=()
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
if [ $COMP_CWORD -eq 1 ]; then
|
||||
COMPREPLY=( $(compgen -o filenames -W "$@" $cur) )
|
||||
fi
|
||||
}
|
||||
|
||||
_upstart_complete() { _upstart_comp_list "$(initctl list 2>&1 | grep -E "$1" | cut -f2 -d ' ')"; }
|
||||
|
||||
_waiting(){ _upstart_complete "(waiting|instance)"; }
|
||||
_running(){ _upstart_complete "(running|instance)"; }
|
||||
_jobs(){ _upstart_comp_list "$(ls -1 /etc/event.d 2> /dev/null)"; }
|
||||
|
||||
complete -F _jobs status
|
||||
complete -F _waiting start
|
||||
complete -F _running stop
|
||||
complete -F _running restart
|
Loading…
Reference in New Issue
Block a user