IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41054


Ignore:
Timestamp:
Nov 5, 2019, 8:10:42 AM (7 years ago)
Author:
eugene
Message:

add help option; add -f option (equiv to --files); allow -v and -f to function independently

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20191011/Nebulous/bin/neb-stat

    r40994 r41054  
    1919use URI;
    2020
    21 my ($validate,$server,$nouris);
     21my ($validate,$server,$nouris,$help);
    2222
    2323$server = $ENV{'NEB_SERVER'} unless $server;
    2424
    2525GetOptions(
    26     'server|s=s'     => \$server,
    27     'validate|v'         => \$validate,
    28     'files'          => \$nouris,
     26    'server|s=s'    => \$server,
     27    'validate|v'    => \$validate,
     28    'files|f'       => \$nouris,
     29    'help|h'        => \$help,
    2930) || pod2usage( 2 );
    3031
     32# explicitly defined -h / --help:
     33if ($help) { pod2usage( -verbose => 1 ); }
     34
    3135my $key = shift;
    3236
    3337pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    34 pod2usage( -msg => "Required options: --server", -exitval => 2 )
    35     unless $server;
    36 pod2usage( -msg => "missing key", exitval => 2 )
    37     unless defined $key;
     38pod2usage( -msg => "Required options: --server", -exitval => 2 ) unless $server;
     39pod2usage( -msg => "missing key", exitval => 2 ) unless defined $key;
    3840
    3941my $neb = Nebulous::Client->new(
     
    7577            $md5sum_uniq{$md5sums[$i]} = 1;
    7678            close($fh);
    77         }
    78         else {
     79        } else {
    7980            $existance[$i] = 0;
    8081            $md5sums[$i] = 'NON-EXISTANT';
    8182            $md5sum_uniq{$md5sums[$i]} = 1;
    8283        }
     84
    8385        if (defined($nouris)) {
    8486            $validation[$i] = sprintf("% 3d %32s %s",
     
    8688                                      $md5sums[$i],
    8789                                      $files[$i]);
    88         }
    89         else {
     90        } else {
    9091            $validation[$i] = sprintf("% 3d %32s %s",
    9192                                      $existance[$i],
     
    113114        "instance location:\n", " " x 4,
    114115        join("\n" . " " x 4, @validation), "\n";
     116} else {
     117   
     118    if (defined($nouris)) {
     119        my @files = map {URI->new($_)->file if $_} @$instances;
     120
     121        print
     122            "object id:             ", @$stat[0], "\n",
     123            "key:                   ", @$stat[1], "\n",
     124            "read lock:             ", @$stat[2], "\n",
     125            "write lock:            ", @$stat[3], "\n",
     126            "epoch:                 ", @$stat[4], "\n",
     127            "mtime:                 ", @$stat[5], "\n",
     128            "available instances:   ", @$stat[6], "\n",
     129            "requested instances:   ", $user_copies, "\n",
     130            "total instances:       ", @$stat[7], "\n",
     131           
     132            "instance location:\n", " " x 4,
     133            join("\n" . " " x 4, @files), "\n";
     134    } else {
     135        print
     136            "object id:             ", @$stat[0], "\n",
     137            "key:                   ", @$stat[1], "\n",
     138            "read lock:             ", @$stat[2], "\n",
     139            "write lock:            ", @$stat[3], "\n",
     140            "epoch:                 ", @$stat[4], "\n",
     141            "mtime:                 ", @$stat[5], "\n",
     142            "available instances:   ", @$stat[6], "\n",
     143            "requested instances:   ", $user_copies, "\n",
     144            "total instances:       ", @$stat[7], "\n",
     145           
     146            "instance location:\n", " " x 4,
     147            join("\n" . " " x 4, @$instances), "\n";
     148    }
     149
    115150}
    116 else {
    117     print
    118         "object id:             ", @$stat[0], "\n",
    119         "key:                   ", @$stat[1], "\n",
    120         "read lock:             ", @$stat[2], "\n",
    121         "write lock:            ", @$stat[3], "\n",
    122         "epoch:                 ", @$stat[4], "\n",
    123         "mtime:                 ", @$stat[5], "\n",
    124         "available instances:   ", @$stat[6], "\n",
    125         "requested instances:   ", $user_copies, "\n",
    126         "total instances:       ", @$stat[7], "\n",
    127        
    128         "instance location:\n", " " x 4,
    129         join("\n" . " " x 4, @$instances), "\n";
    130 }
    131151
    132152
     
    151171=over 4
    152172
    153 =item * --server|-s <URL>
     173=item --server|-s <URL>
    154174
    155175URL of the Nebulous server to connect to.
     
    157177Optional if the appropriate environment variable is set.
    158178
    159 =item * --validate|-v
     179=item --validate|-v
    160180
    161181Optional - prints out additional information including md5sum.
    162182
    163 =item * --files
     183=item --files
    164184
    165185Optional - prints out disk files instead of uris during validate stage.
     
    175195=over 4
    176196
    177 =item * C<NEB_SERVER>
     197=item C<NEB_SERVER>
    178198
    179199Equivalent to --server|-s
Note: See TracChangeset for help on using the changeset viewer.