2 * Copyright (c) 2009-2012 Zmanda, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
19 * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
26 Amanda::Cmdline - utilities for handling command lines
32 my $spec = Amanda::Cmdline::dumpspec_t->new($host, $disk, $datestamp, $level, $write_timestamp);
33 print "host: $spec->{'host'}; disk: $spec->{'disk'}\n";
35 my @specs = Amanda::Cmdline::parse_dumpspecs(["host", "disk", "date"],
36 $Amanda::Cmdline::CMDLINE_PARSE_DATESTAMP);
38 =head1 Amanda::Cmdline::dumpspec_t Objects
40 Note that this class was called C<Amanda::Cmdline::dumpspec_t> in older versions;
41 that name will still work, but is deprecated.
45 Each key contains a match expression, in the form of a string, or undef. Note
46 that the values of these keys are read-only.
50 =item C<< $ds->{'host'} >>
54 =item C<< $ds->{'disk'} >>
58 =item C<< $ds->{'datestamp'} >>
62 =item C<< $ds->{'level'} >>
66 =item C<< $ds->{'write_timestamp'} >>
68 Timestamp when the dump is written to storage media.
76 =item C<< $ds->format() >>
78 Format the dumpspec as a string.
82 =head1 Package Functions
86 =item C<format_dumpspec_components($host, $disk, $datestamp, $level)>
88 This function returns a string representing the formatted form of the
89 given dumpspec. This formatting is the same as performed by
90 C<< $ds->format() >>, but does not need a C<Dumpspec>.
92 =item C<parse_dumpspecs([@cmdline], $flags)>
94 This function parses C<@cmdline> into a list of C<Dumpspec> objects,
95 according to C<$flags>, which is a logical combination of zero or more
98 $CMDLINE_PARSE_DATESTAMP - recognize datestamps
99 $CMDLINE_PARSE_LEVEL - recognize levels
100 $CMDLINE_EMPTY_TO_WILDCARD - if @cmdline is empty, make a wildcard dumpspec
102 These constants are available in export tag C<:constants>. The command-line
105 [host [disk [datestamp [level [host [..]]]]]]
107 Note that there is no facility for specifying C<write_timestamp> on the command
110 =item C<header_matches_dumpspecs($hdr, [@dumpspecs])>
112 This function compares a header to a list of dumpspecs, returning true if the
113 header matches at least one dumpspec. If C<@dumpspecs> is empty, the function
120 L<Amanda::Config> handles C<-o> options itself, through