2 * Copyright (c) 2009, 2010 Zmanda, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published
6 * by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
18 * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
25 Amanda::Cmdline - utilities for handling command lines
31 my $spec = Amanda::Cmdline::dumpspec_t->new($host, $disk, $datestamp, $level, $write_timestamp);
32 print "host: $spec->{'host'}; disk: $spec->{'disk'}\n";
34 my @specs = Amanda::Cmdline::parse_dumpspecs(["host", "disk", "date"],
35 $Amanda::Cmdline::CMDLINE_PARSE_DATESTAMP);
37 =head1 Amanda::Cmdline::dumpspec_t Objects
39 Note that this class was called C<Amanda::Cmdline::dumpspec_t> in older versions;
40 that name will still work, but is deprecated.
44 Each key contains a match expression, in the form of a string, or undef. Note
45 that the values of these keys are read-only.
49 =item C<< $ds->{'host'} >>
53 =item C<< $ds->{'disk'} >>
57 =item C<< $ds->{'datestamp'} >>
61 =item C<< $ds->{'level'} >>
65 =item C<< $ds->{'write_timestamp'} >>
67 Timestamp when the dump is written to storage media.
75 =item C<< $ds->format() >>
77 Format the dumpspec as a string.
81 =head1 Package Functions
85 =item C<format_dumpspec_components($host, $disk, $datestamp, $level)>
87 This function returns a string representing the formatted form of the
88 given dumpspec. This formatting is the same as performed by
89 C<< $ds->format() >>, but does not need a C<Dumpspec>.
91 =item C<parse_dumpspecs([@cmdline], $flags)>
93 This function parses C<@cmdline> into a list of C<Dumpspec> objects,
94 according to C<$flags>, which is a logical combination of zero or more
97 $CMDLINE_PARSE_DATESTAMP - recognize datestamps
98 $CMDLINE_PARSE_LEVEL - recognize levels
99 $CMDLINE_EMPTY_TO_WILDCARD - if @cmdline is empty, make a wildcard dumpspec
101 These constants are available in export tag C<:constants>. The command-line
104 [host [disk [datestamp [level [host [..]]]]]]
106 Note that there is no facility for specifying C<write_timestamp> on the command
109 =item C<header_matches_dumpspecs($hdr, [@dumpspecs])>
111 This function compares a header to a list of dumpspecs, returning true if the
112 header matches at least one dumpspec. If C<@dumpspecs> is empty, the function
119 L<Amanda::Config> handles C<-o> options itself, through