Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] bash_completion: improvement, fixes and tests [was: Re: subversion and programmable completion]



Julian Foad <julianfoad@xxxxxxxxxxxxxxx> writes:

> # Print the valid subcommands for "svn", one per line, sorted.
> # Usage: get_svn_subcommands
> get_svn_subcommands() {
>   svn help |
>     # Find the relevant lines;
>     # remove brackets and commas; put each word on its own line.
>     sed -n -e '1,/^Available subcommands:$/d;/^$/q' \
>            -e 's/[ )]//g;s/[(,]/\n/g;p' |
>     sort
> }
[...]
> echo "Checking list of subcommands"
> HELP_SUBCMDS=`get_svn_subcommands | tr "\n" " "`

At this point "echo $HELP_SUBCMDS" gives

add cat checkoutnco cleanup commitnci copyncp deletendelnremovenrm diffndi export helpn?nh import info listnls log merge mkdir movenmvnrenamenren propdelnpdel propeditnpeditnpe propgetnpgetnpg proplistnplistnpl propsetnpsetnps resolve revert statusnstatnst switchnsw updatenup

$ sed -V | head -1
GNU sed version 3.02
$ echo 'x(y' | sed 's/[(,]/\n/g'
xny


-- 
Philip Martin



Messages sorted by: Reverse Date, Date, Thread, Author