|
0
|
1 #/bin/perl
|
|
|
2 #
|
|
|
3 #------------------------------------------------------------------------------
|
|
|
4 # University of Minnesota
|
|
|
5 # Copyright 2010 - 2011, Regents of the University of Minnesota
|
|
|
6 #------------------------------------------------------------------------------
|
|
|
7 # Author:
|
|
|
8 #
|
|
|
9 # Jesse Erdmann
|
|
|
10 #
|
|
|
11 # POD documentation
|
|
|
12 #------------------------------------------------------------------------------
|
|
|
13 =pod BEGIN
|
|
|
14
|
|
|
15 =head1 NAME
|
|
|
16
|
|
|
17 list_projects.pl - TAPDANCE utility to list projects in the database
|
|
|
18
|
|
|
19 TAPDANCE functionality.
|
|
|
20
|
|
|
21 =head1 SYNOPSIS
|
|
|
22
|
|
|
23 list_projects.pl [-help]
|
|
|
24
|
|
|
25 See http://sf.net/p/tapdancebio for full documentation
|
|
|
26
|
|
|
27 =head1 OPTIONS
|
|
|
28
|
|
|
29 =over 6
|
|
|
30
|
|
|
31 =item B<-help>
|
|
|
32
|
|
|
33 Print this usage summary.
|
|
|
34
|
|
|
35 =item B<-user username>
|
|
|
36
|
|
|
37 Filter projects based on the user that created the project.
|
|
|
38
|
|
|
39 =item B<-tag tags>
|
|
|
40
|
|
|
41 Any number of tags may be specified to filter projects where at least
|
|
|
42 one of the tags has been specified as a metadata element for a library
|
|
|
43 within the project.
|
|
|
44
|
|
|
45 =back
|
|
|
46
|
|
|
47 =cut
|
|
|
48
|
|
|
49 #### END of POD documentation.
|
|
|
50 #-----------------------------------------------------------------------------
|
|
|
51 use strict;
|
|
|
52 use Getopt::Long;
|
|
|
53 use Pod::Usage;
|
|
|
54
|
|
|
55 my $path = $0;
|
|
|
56 $path =~ s/\/\w*\.pl$//g;
|
|
|
57 require "$path/tapdance_base_config.pl";
|
|
|
58 require "$path/project_man.pl";
|
|
|
59 require "$path/util.pl";
|
|
|
60
|
|
|
61 my $user = "cmd_line";
|
|
|
62 my ($out_file, $help_flag);
|
|
|
63 my @tags = ();
|
|
|
64 my $query_type = "all";
|
|
|
65 my $db_config;
|
|
|
66 my %options = (
|
|
|
67 "user|u=s" => \$user,
|
|
|
68 "tag=s" => \@tags,
|
|
|
69 "query_type=s" => \$query_type,
|
|
|
70 "db_config=s" => \$db_config,
|
|
|
71 "help" => \$help_flag
|
|
|
72 );
|
|
|
73
|
|
|
74 GetOptions(%options) or pod2usage(2);
|
|
|
75 pod2usage(1) if $help_flag;
|
|
|
76
|
|
|
77 if (defined($db_config)) {
|
|
|
78 my $db_cnf_path = $path . "/" . $db_config;
|
|
|
79 require "$db_cnf_path";
|
|
|
80 }
|
|
|
81
|
|
|
82 $user = &sanitize_project($user);
|
|
|
83
|
|
|
84 my $projects_ref = &get_project_list($user, $query_type, @tags);
|
|
|
85 foreach my $project (@{$projects_ref}) {
|
|
|
86 my $full_name = $project;
|
|
|
87 $project =~ s/$user//;
|
|
|
88 print "$full_name\t$project\n";
|
|
|
89 }
|
|
|
90
|
|
|
91 exit;
|