Home | History | Annotate | Line # | Download | only in scripts
plot_summary-opts revision 1.1.1.2.4.5
      1  1.1.1.2.4.2  snj # EDIT THIS FILE WITH CAUTION  (plot_summary-opts)
      2  1.1.1.2.4.2  snj #
      3  1.1.1.2.4.5  snj # It has been AutoGen-ed  March 21, 2017 at 10:40:37 AM by AutoGen 5.18.5
      4  1.1.1.2.4.2  snj # From the definitions    plot_summary-opts.def
      5  1.1.1.2.4.2  snj # and the template file   perlopt
      6  1.1.1.2.4.2  snj 
      7  1.1.1.2.4.2  snj use Getopt::Long qw(GetOptionsFromArray);
      8  1.1.1.2.4.2  snj Getopt::Long::Configure(qw(no_auto_abbrev no_ignore_case_always));
      9  1.1.1.2.4.2  snj 
     10  1.1.1.2.4.2  snj my $usage;
     11  1.1.1.2.4.2  snj 
     12  1.1.1.2.4.2  snj sub usage {
     13  1.1.1.2.4.2  snj     my ($ret) = @_;
     14  1.1.1.2.4.2  snj     print STDERR $usage;
     15  1.1.1.2.4.2  snj     exit $ret;
     16  1.1.1.2.4.2  snj }
     17  1.1.1.2.4.2  snj 
     18  1.1.1.2.4.2  snj sub paged_usage {
     19  1.1.1.2.4.2  snj     my ($ret) = @_;
     20  1.1.1.2.4.2  snj     my $pager = $ENV{PAGER} || '(less || more)';
     21  1.1.1.2.4.2  snj 
     22  1.1.1.2.4.2  snj     open STDOUT, "| $pager" or die "Can't fork a pager: $!";
     23  1.1.1.2.4.2  snj     print $usage;
     24  1.1.1.2.4.2  snj 
     25  1.1.1.2.4.2  snj     exit $ret;
     26  1.1.1.2.4.2  snj }
     27  1.1.1.2.4.2  snj 
     28  1.1.1.2.4.2  snj sub processOptions {
     29  1.1.1.2.4.2  snj     my $args = shift;
     30  1.1.1.2.4.2  snj 
     31  1.1.1.2.4.2  snj     my $opts = {
     32  1.1.1.2.4.2  snj         'directory' => '/tmp',
     33  1.1.1.2.4.2  snj         'identifier' => '',
     34  1.1.1.2.4.2  snj         'offset-limit' => '0.128',
     35  1.1.1.2.4.2  snj         'peer' => [],
     36  1.1.1.2.4.2  snj         'plot-term' => '',
     37  1.1.1.2.4.2  snj         'output-file' => '',
     38  1.1.1.2.4.2  snj         'dont-wait' => '',
     39  1.1.1.2.4.2  snj         'help' => '', 'more-help' => ''
     40  1.1.1.2.4.2  snj     };
     41  1.1.1.2.4.2  snj     my $argument = '';
     42  1.1.1.2.4.2  snj     my $ret = GetOptionsFromArray($args, $opts, (
     43  1.1.1.2.4.2  snj         'directory=s', 'identifier=s', 'offset-limit=f',
     44  1.1.1.2.4.2  snj         'peer=s', 'plot-term=s', 'output-file=s',
     45  1.1.1.2.4.2  snj         'dont-wait',
     46  1.1.1.2.4.2  snj         'help|?', 'more-help'));
     47  1.1.1.2.4.2  snj 
     48  1.1.1.2.4.2  snj     $usage = <<'USAGE';
     49  1.1.1.2.4.5  snj plot_summary - plot statistics generated by summary script - Ver. 4.2.8p10
     50  1.1.1.2.4.2  snj USAGE: plot_summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]... 
     51  1.1.1.2.4.2  snj 
     52  1.1.1.2.4.2  snj         --directory=str          Where the summary files are
     53  1.1.1.2.4.2  snj         --identifier=str         Origin of the data
     54  1.1.1.2.4.2  snj         --offset-limit=float     Limit of absolute offset
     55  1.1.1.2.4.2  snj         --peer=str               Peers to generate plots for
     56  1.1.1.2.4.2  snj                                    - may appear multiple times
     57  1.1.1.2.4.2  snj         --plot-term=str          Gnuplot terminal
     58  1.1.1.2.4.2  snj         --output-file=str        Output file
     59  1.1.1.2.4.2  snj         --dont-wait              Don't wait for keystroke between plots
     60  1.1.1.2.4.2  snj     -?, --help                   Display usage information and exit
     61  1.1.1.2.4.2  snj         --more-help              Pass the extended usage text through a pager
     62  1.1.1.2.4.2  snj 
     63  1.1.1.2.4.2  snj Options are specified by doubled hyphens and their name or by a single
     64  1.1.1.2.4.2  snj hyphen and the flag character.
     65  1.1.1.2.4.2  snj USAGE
     66  1.1.1.2.4.2  snj 
     67  1.1.1.2.4.2  snj     usage(0)       if $opts->{'help'};
     68  1.1.1.2.4.2  snj     paged_usage(0) if $opts->{'more-help'};
     69  1.1.1.2.4.2  snj     $_[0] = $opts;
     70  1.1.1.2.4.2  snj     return $ret;
     71  1.1.1.2.4.2  snj }
     72  1.1.1.2.4.2  snj 
     73  1.1.1.2.4.2  snj END { close STDOUT };
     74