#!/usr/bin/perl
# when no args
#     list all the prjs in the localhost
#         -v: list the prcs info output for each prj 
# when args presented
#     list for the specified prjs
#  
use Getopt::Std;
getopts('v');   
$REP=$ENV{PRCS_REPOSITORY};
$HOME=$ENV{HOME};
$REP="$HOME/PRCS" unless $REP;

if ( $#ARGV==-1 ) {
  open (PRJS, "ls $REP |");
  print "Follwoing projetcs presented:\n";
  while (<PRJS>) {
    print ++$i, ") ", $_;
    if ($opt_v) {
      system("prcs info -f $_");
      print "\n";
    }  
  }  
}
else {
  while ( $p=shift @ARGV ) {
    if ($opt_v) {
      system("prcs info -f -l $p");
    } 
    else {
      system("prcs info -f $p");
    }
  } 
}
