forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathctquery
More file actions
executable file
·42 lines (39 loc) · 1.33 KB
/
ctquery
File metadata and controls
executable file
·42 lines (39 loc) · 1.33 KB
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
#!/usr/bin/perl
# acceptable forms:
# ctquery - list all attached projects and flavors
# ctquery project - list the attached flavor of the named project
# ctquery - flavor - list all attached projects who are attached with a
# given flavor
$projs = $ENV{"CTPROJS"} ;
@projlist = split( / +/, $projs ) ;
if ( $#ARGV == -1 ) {
# list all projects and flavors
print "Currently attached projects (and flavors):\n" ;
foreach $pair ( @projlist ) {
@pairlist = split( /:/, $pair ) ;
( $pairtmp = $pairlist[0] ) =~ tr/A-Z/a-z/ ;
print " $pairtmp ($pairlist[1])\n" ;
}
} elsif (( $#ARGV == 0 ) && !($ARGV[0] =~ /^\-/)) {
# list the attached flavor of the named project
foreach $pair ( @projlist ) {
@pairlist = split( /:/, $pair ) ;
( $pairtmp = $pairlist[0] ) =~ tr/A-Z/a-z/ ;
if ( $pairtmp eq $ARGV[0] ) {
print "$pairlist[1]\n" ;
}
}
} elsif (( $#ARGV == 1 ) && ( $ARGV[0] eq "-" )){
# list all attached projects who are attached with a given flavor
foreach $pair ( @projlist ) {
@pairlist = split( /:/, $pair ) ;
if ( $pairlist[1] eq $ARGV[1] ) {
$pairlist[0] =~ tr/A-Z/a-z/ ;
print "$pairlist[0]\n" ;
}
}
} else {
print "Usage: ctquery [project] -or-\n" ;
print " ctquery - flavor\n" ;
exit ;
}