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