This repository has been archived by the owner on Aug 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsourceMe
116 lines (76 loc) · 3.26 KB
/
sourceMe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
# General bash setup for command-subcommand autocomplete.
# This will also add the main command to your $PATH.
# Source this file from your .profile or .bashrc to make permanent.
## e.g., `source /PATH/TO/THIS/FILE/THISFILE.completion`
CLDBBINDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
export PATH="$PATH:$CLDBBINDIR"
CLDBBINDIR=$CLDBBINDIR'/bin/'
CLdbSubcmds=`find $CLDBBINDIR -maxdepth 1 -regex '.+\.\(pl\|r\)' | perl -pe 's/.+\///; s/\.[^.]+$/ /g'`
CLdbArrayBlastDir=$CLDBBINDIR'/bin_arrayBlast/'
CLdbArrayBlastSubcmds=`find $CLdbArrayBlastDir -maxdepth 1 -regex '.+\.\(pl\|r\)' | perl -pe 's/.+\///; s/\.[^.]+$/ /g'`
CLdbPlotLociDir=$CLDBBINDIR'/bin_plotLoci/'
CLdbPlotLociSubcmds=`find $CLdbPlotLociDir -maxdepth 1 -regex '.+\.\(pl\|r\)' | perl -pe 's/.+\///; s/\.[^.]+$/ /g'`
_CLdb()
{
local fileNames dirNames cur prev prev2
cur=${COMP_WORDS[COMP_CWORD]}
first=${COMP_WORDS[0]}
prev=${COMP_WORDS[COMP_CWORD-1]}
prev2=${COMP_WORDS[COMP_CWORD-2]}
fileNames=''
dirNames=''
if [[ ${cur} == * && ${prev} == --* && ${prev2} == arrayBlast ]]; then
COMPREPLY=($(compgen -W "$CLdbArrayBlastSubcmds" ${cur}))
elif [[ ${cur} == * && ${prev} == --* && ${prev2} == plotLoci ]]; then
COMPREPLY=($(compgen -W "$CLdbPlotLociSubcmds" ${cur}))
elif [[ ${cur} == * && ${prev} == --* && ${first} == *CLdb ]]; then
COMPREPLY=($(compgen -W "$CLdbSubcmds" ${cur}))
elif [[ ${cur} == * ]]; then
fileNames=$( compgen -f -X '.*' -- "$cur" )
dirNames=$( compgen -d -X '.*' -- "$cur" )
COMPREPLY=(
$( compgen -W "$fileNames $dirNames" -- $cur )
)
else
# no hidden files/directories
fileNames=$( compgen -f -X '.*' -- "$cur" )
dirNames=$( compgen -d -X '.*' -- "$cur" )
COMPREPLY=(
$( compgen -W "$fileNames $dirNames" -- $cur )
)
fi
}
complete -o default -F _CLdb CLdb
# Edit path to where CLdb bin directory is:
#CLDBBINDIR='/home/nyoungb2/perl/projects/CLdb/bin/'
#subcmds=`find $CLDBBINDIR -maxdepth 1 -regex '.+\.\(pl\|r\)' | perl -pe 's/.+\///; s/\.[^.]+$/ /g'`
#arrayBlastDir=$CLDBBINDIR'/bin_arrayBlast/'
#arrayBlastSubcmds=`find $arrayBlastDir -maxdepth 1 -regex '.+\.\(pl\|r\)' | perl -pe 's/.+\///; s/\.[^.]+$/ /g'`
#plotLociDir=$CLDBBINDIR'/bin_plotLoci/'
#plotLociSubcmds=`find $plotLociDir -maxdepth 1 -regex '.+\.\(pl\|r\)' | perl -pe 's/.+\///; s/\.[^.]+$/ /g'`
_CLdb_perldoc()
{
local fileNames dirNames cur prev prev2
cur=${COMP_WORDS[COMP_CWORD]}
first=${COMP_WORDS[0]}
prev=${COMP_WORDS[COMP_CWORD-1]}
prev2=${COMP_WORDS[COMP_CWORD-2]}
fileNames=''
dirNames=''
if [[ ${cur} == * && ${prev} == --* && ${prev2} == arrayBlast ]]; then
COMPREPLY=($(compgen -W "$CLdbArrayBlastSubcmds" ${cur}))
elif [[ ${cur} == * && ${prev} == --* && ${prev2} == plotLoci ]]; then
COMPREPLY=($(compgen -W "$CLdbPlotLociSubcmds" ${cur}))
elif [[ ${cur} == * && ${prev} == --* && ${first} == *CLdb_perldoc ]]; then
COMPREPLY=($(compgen -W "$CLdbSubcmds" ${cur}))
else
# no hidden files/directories
fileNames=$( compgen -f -X '.*' -- "$cur" )
dirNames=$( compgen -d -X '.*' -- "$cur" )
COMPREPLY=(
$( compgen -W "$fileNames $dirNames" -- $cur )
)
fi
}
complete -o default -F _CLdb_perldoc CLdb_perldoc