1SVK::Command(3)       User Contributed Perl Documentation      SVK::Command(3)
2
3
4

NAME

6       SVK::Command - Base class and dispatcher for SVK commands
7

SYNOPSIS

9           use SVK::Command;
10           my $xd = SVK::XD->new ( ... );
11           my $cmd = 'checkout';
12           my @args = qw( file1 file2 );
13           open my $output_fh, '>', 'svk.log' or die $!;
14           SVK::Command->invoke ($xd, $cmd, $output_fh, @args);
15

DESCRIPTION

17       This module resolves alias for commands and dispatches them, usually
18       with the "invoke" method.  If the command invocation is incorrect,
19       usage information is displayed instead.
20

METHODS

22   Class Methods
23       invoke ($xd, $cmd, $output_fh, @args)
24
25       Takes a SVK::XD object, the command name, the output scalar reference,
26       and the arguments for the command. The command name is translated with
27       the %alias map.
28
29       On Win32, after @args is parsed for named options, the remaining
30       positional arguments are expanded for shell globbing with "bsd_glob".
31
32       getopt ($argv, %opt)
33
34       Takes a arrayref of argv for run getopt for the command, with
35       additional %opt getopt options.
36
37   Instance Methods
38       "SVK::Command->invoke" loads the corresponding class
39       "SVK::Command::$name", so that's the class you want to implement the
40       following methods in:
41
42       options ()
43
44       Returns a hash where the keys are Getopt::Long specs and the values are
45       a string that will be the keys storing the parsed option in $self.
46
47       Subclasses should override this to add their own options.  Defaults to
48       an empty list.
49
50       opt_recursive
51
52       Defines if the command needs the recursive flag and its default.  The
53       value will be stored in "recursive".
54
55       parse_arg (@args)
56
57       This method is called with the remaining arguments after parsing named
58       options with "options" above.  It should use the "arg_*" methods to
59       return a list of parsed arguments for the command's "lock" and "run"
60       method to process.  Defaults to return a single "undef".
61
62       lock (@parse_args)
63
64       Calls the "lock_*" methods to lock the SVK::XD object. The arguments
65       will be what is returned from "parse_arg".
66
67       run (@parsed_args)
68
69       Actually process the command. The arguments will be what is returned
70       from "parse_arg".
71
72       Returned undef on success. Return a string message to notify the caller
73       errors.
74
75   Utility Methods
76       Except for "arg_depotname", all "arg_*" methods below returns a
77       SVK::Path object, which consists of a hash with the following keys:
78
79       cinfo
80       copath
81       depotpath
82       path
83       repos
84       repospath
85       report
86       targets
87
88       The hashes are handy to pass to many other functions.
89
90       arg_condensed (@args)
91
92       Argument is a number of checkout paths.
93
94       arg_uri_maybe ($arg, $no_new_mirror)
95
96       Argument might be a URI or a depotpath.  If it is a URI, try to find it
97       at or under one of currently mirrored paths.  If not found, prompts the
98       user to mirror and sync it.
99
100       arg_co_maybe ($arg, $no_new_mirror)
101
102       Argument might be a checkout path or a depotpath. If argument is URI
103       then handles it via "arg_uri_maybe".
104
105       arg_copath ($arg)
106
107       Argument is a checkout path.
108
109       arg_depotpath ($arg)
110
111       Argument is a depotpath, including the slashes and depot name.
112
113       arg_depotroot ($arg)
114
115       Argument is a depot root, or a checkout path that needs to be resolved
116       into a depot root.
117
118       arg_depotname ($arg)
119
120       Argument is a name of depot. such as '' or 'test' that is being used
121       normally between two slashes.
122
123       arg_path ($arg)
124
125       Argument is a plain path in the filesystem.
126
127       apply_revision($target)
128
129       Apply the given revision from command line to $target.
130
131       parse_revlist ()
132
133       Parse -c or -r to a list of [from, to] pairs.
134
135       lock_target ($target)
136
137       XXX Undocumented
138
139       lock_coroot ($target)
140
141       XXX Undocumented
142
143       brief_usage ($file)
144
145       Display an one-line brief usage of the command object.  Optionally, a
146       file could be given to extract the usage from the POD.
147
148       filename
149
150       Return the filename for the command module.
151
152       usage ($want_detail)
153
154       Display usage.  If $want_detail is true, the "DESCRIPTION" section is
155       displayed as well.
156
157   Error Handling
158       handle_error ($error)
159
160       XXX Undocumented
161
162       add_handler ($error, $handler)
163
164       XXX Undocumented
165
166       msg_handler ($error, $message)
167
168       XXX Undocumented
169
170       msg_handler ($error)
171
172       XXX Undocumented
173
174       command ($cmd, \%args)
175
176       Construct a command object of the $cmd subclass and return it.
177
178       The new object will share the "xd" from the calling command object;
179       contents in %args is also assigned into the new object.
180
181       rebless ($cmd, \%args)
182
183       Like "command" above, but modifies the calling object instead of
184       creating a new one.  Useful for a command object to recast itself into
185       another command class.
186
187       run_command_recursively($target, $code)
188
189       Traverse $target and and invoke $code with each node.
190

SEE ALSO

192       SVK, SVK::XD, "SVK::Command::*"
193
194
195
196perl v5.32.0                      2020-07-28                   SVK::Command(3)
Impressum