File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ if [[ " $1 " == " " ]]; then
4
+ echo " usage $0 outfile"
5
+ exit 1
6
+ fi
7
+ out=" $1 "
8
+
9
+ echo " " > $out
10
+
11
+ for progname in arangob arangosh arangoimp arangodump arangorestore arangod
12
+ do
13
+ # find the executable
14
+ # check if the executable exists
15
+ if [[ -f " bin/$progname " ]]; then
16
+ executable=" bin/$progname "
17
+
18
+ # setup the help command string
19
+ command=" --help"
20
+ if [ " x$progname " == " xarangod" ]; then
21
+ command=" --help-all"
22
+ fi
23
+
24
+ # set up the list of completions for the executable
25
+ # completions="`\"$executable\" $command | grep -o \"^\\ \\+--[a-z-]\\+\\(\\.[a-z0-9-]\\+\\)\\?\" | sed -e \"s/^/complete --command $progname -a /g\"`"
26
+ echo " # completions for $progname " >> " $out "
27
+
28
+ completions=" ` \" $executable \" $command ` "
29
+ (echo " $completions " | grep " ^ " | awk ' /^ --/{if (x)print x;x="";}{x=(!x)?$0:x" "$0;}END{print x;}' | sed -e " s/ \+/ /g" | sed -e " s/(default:.*)//g" | sed -e " s/(current:.*)//g" | sed -e " s/<[a-zA-Z0-9]\+>//g" | tr -d " '" | sed -e " s/^ \+--\([a-zA-Z0-9.\-]\+\) \+\(.\+\)$/complete --command $progname -l '\\ 1' -d '\\ 2'/g" | sed -e " s/ \+'$/'/g" ) >> " $out "
30
+
31
+ echo " " >> " $out "
32
+ fi
33
+ done
34
+
35
+ echo " completions stored in file $out "
36
+ echo " now copy this file to /etc/bash_completion.d/arangodb"
You can’t perform that action at this time.
0 commit comments