File Coverage

blib/lib/App/Sqitch/Command.pm
Criterion Covered Total %
statement 155 155 100.0
branch 58 62 93.5
condition 23 29 79.3
subroutine 29 29 100.0
pod 10 10 100.0
total 275 285 96.4


line stmt bran cond sub pod time code
1             package App::Sqitch::Command;
2              
3 51     51   994 use 5.010;
  51         199  
4 51     51   331 use strict;
  51         104  
  51         1876  
5 51     51   254 use warnings;
  51         152  
  51         2752  
6 51     51   360 use utf8;
  51         131  
  51         435  
7 51     51   2042 use Try::Tiny;
  51         139  
  51         4311  
8 51     51   364 use Locale::TextDomain qw(App-Sqitch);
  51         117  
  51         653  
9 51     51   13368 use App::Sqitch::X qw(hurl);
  51         184  
  51         616  
10 51     51   19822 use Hash::Merge 'merge';
  51         114  
  51         3692  
11 51     51   381 use File::Path qw(make_path);
  51         111  
  51         3104  
12 51     51   314 use Moo;
  51         172  
  51         465  
13 51     51   30318 use App::Sqitch::Types qw(Sqitch Target);
  51         128  
  51         656  
14              
15             our $VERSION = 'v1.6.1'; # VERSION
16              
17 51         139884 use constant ENGINES => qw(
18             pg
19             sqlite
20             mysql
21             oracle
22             firebird
23             vertica
24             exasol
25             snowflake
26             cockroach
27             clickhouse
28 51     51   146770 );
  51         131  
29              
30             has sqitch => (
31             is => 'ro',
32             isa => Sqitch,
33             required => 1,
34             handles => [qw(
35             run
36             shell
37             quote_shell
38             capture
39             probe
40             verbosity
41             trace
42             trace_literal
43             debug
44             debug_literal
45             info
46             info_literal
47             comment
48             comment_literal
49             emit
50             emit_literal
51             vent
52             vent_literal
53             warn
54             warn_literal
55             page
56             page_literal
57             prompt
58             ask_y_n
59             )],
60             );
61              
62             has default_target => (
63             is => 'ro',
64             isa => Target,
65             lazy => 1,
66             default => sub {
67             my $self = shift;
68             my $sqitch = $self->sqitch;
69             my @params = $self->target_params;
70             unless (
71             $sqitch->config->get(key => 'core.engine')
72             || $sqitch->config->get(key => 'core.target')
73             ) {
74             # No specified engine, so specify an engineless URI.
75             require URI::db;
76             unshift @params, uri => URI::db->new('db:');
77             }
78             require App::Sqitch::Target;
79             return App::Sqitch::Target->new(@params);
80             },
81             );
82              
83             sub command {
84 266   66 266 1 31964 my $class = ref $_[0] || shift;
85 266 100       875 return '' if $class eq __PACKAGE__;
86 263         542 my $pkg = quotemeta __PACKAGE__;
87 263         2610 $class =~ s/^$pkg\:://;
88 263         799 $class =~ s/_/-/g;
89 263         1609 return $class;
90             }
91              
92             sub class_for {
93 67     67 1 2074 my ( $class, $sqitch, $cmd ) = @_;
94              
95 67         298 $cmd =~ s/-/_/g;
96              
97             # Load the command class.
98 67         225 my $pkg = __PACKAGE__ . "::$cmd";
99 67 100       7802 eval "require $pkg; 1" or do {
100             # Emit the original error for debugging.
101 9         710 $sqitch->debug($@);
102 4         361 return undef;
103             };
104 58         572 return $pkg;
105             }
106              
107             sub load {
108 39     39 1 80770 my ( $class, $p ) = @_;
109             # We should have a command.
110 39 100       310 my $cmd = delete $p->{command} or $class->usage;
111 38 100       242 my $pkg = $class->class_for($p->{sqitch}, $cmd) or hurl {
112             ident => 'command',
113             exitval => 1,
114             message => __x(
115             '"{command}" is not a valid command',
116             command => $cmd,
117             ),
118             };
119 35         489 $pkg->create($p);
120             }
121              
122             sub create {
123 46     46 1 2194 my ( $class, $p ) = @_;
124              
125             # Merge the command-line options and configuration parameters
126             my $params = $class->configure(
127             $p->{config},
128             $class->_parse_opts( $p->{args} )
129 46         481 );
130              
131             # Instantiate and return the command.
132 46         5134 $params->{sqitch} = $p->{sqitch};
133 46         1335 return $class->new($params);
134             }
135              
136             sub configure {
137 95     95 1 23390 my ( $class, $config, $options ) = @_;
138              
139 95         889 return Hash::Merge->new->merge(
140             $options,
141             $config->get_section( section => $class->command ),
142             );
143             }
144              
145             sub options {
146 7     7 1 44 return;
147             }
148              
149             sub _parse_opts {
150 51     51   4931 my ( $class, $args ) = @_;
151 51 100 100     816 return {} unless $args && @{$args};
  22         107  
152              
153 18         40 my %opts;
154 18         124 Getopt::Long::Configure(qw(bundling no_pass_through));
155 18 100       1339 Getopt::Long::GetOptionsFromArray( $args, \%opts, $class->options )
156             or $class->usage;
157              
158             # Convert dashes to underscores.
159 18         11216 for my $k (keys %opts) {
160 10 100       56 next unless ( my $nk = $k ) =~ s/-/_/g;
161 2         6 $opts{$nk} = delete $opts{$k};
162             }
163              
164 18         425 return \%opts;
165             }
166              
167             sub _bn {
168 11     11   55 require File::Basename;
169 11         600 File::Basename::basename($0);
170             }
171              
172             sub _pod2usage {
173 8     8   90693 my ( $self, %params ) = @_;
174 8         48 my $command = $self->command;
175 8         146 require Pod::Find;
176 8         42 require Pod::Usage;
177 8         30 my $bn = _bn;
178             my $find_pod = sub {
179 26     26   29513 Pod::Find::pod_where({ '-inc' => 1, '-script' => 1 }, shift );
180 8         56 };
181 8   33     71 $params{'-input'} ||= $find_pod->("$bn-$command")
      66        
182             || $find_pod->("sqitch-$command")
183             || $find_pod->($bn)
184             || $find_pod->('sqitch')
185             || $find_pod->(ref $self || $self)
186             || $find_pod->(__PACKAGE__);
187 8         91 Pod::Usage::pod2usage(
188             '-verbose' => 99,
189             '-sections' => '(?i:(Usage|Synopsis|Options))',
190             '-exitval' => 2,
191             %params,
192             );
193             }
194              
195             sub execute {
196 2     2 1 160 my $self = shift;
197 2 100       17 hurl(
198             'The execute() method must be called from a subclass of '
199             . __PACKAGE__
200             ) if ref $self eq __PACKAGE__;
201              
202 1         8 hurl 'The execute() method has not been overridden in ' . ref $self;
203             }
204              
205             sub usage {
206 3     3 1 144212 my $self = shift;
207 3         36 require Pod::Find;
208 3         16 my $upod = _bn . '-' . $self->command . '-usage';
209 3   50     3720 $self->_pod2usage(
210             '-input' => Pod::Find::pod_where( { '-inc' => 1 }, $upod ) || undef,
211             '-message' => join '', @_
212             );
213             }
214              
215             sub target_params {
216 256     256 1 3428 return (sqitch => shift->sqitch);
217             }
218              
219             sub parse_args {
220 180     180 1 78072 my ($self, %p) = @_;
221 180         6864 my $config = $self->sqitch->config;
222 180         5615 my @params = $self->target_params;
223              
224             # Load the specified or default target.
225 180         2264 require App::Sqitch::Target;
226 180         436 my $deftarget_err;
227             my $target = try {
228             App::Sqitch::Target->new( @params, name => $p{target} )
229 180     180   17297 } catch {
230             # Die if a target was specified; otherwise keep the error for later.
231 4 100   4   9234 die $_ if $p{target};
232 3         10 $deftarget_err = $_;
233 3         18 undef;
234 180         2349 };
235              
236             # Set up the default results.
237 179         23806 my (%seen, %target_for);
238 179         549 my %rec = map { $_ => [] } qw(targets unknown);
  358         1466  
239 179 100       1031 $rec{changes} = [] unless $p{no_changes};
240 179 100       712 if ($p{target}) {
241 46         94 push @{ $rec{targets} } => $target;
  46         150  
242 46         279 $seen{$target->name}++;
243             }
244              
245             # Iterate over the args to look for changes, engines, plans, or targets.
246 179         674 my %engines = map { $_ => 1 } ENGINES;
  1790         16699  
247 179         505 for my $arg (@{ $p{args} }) {
  179         645  
248 194 100 100     6495 if ( !$p{no_changes} && $target && -e $target->plan_file && $target->plan->contains($arg) ) {
    100 100        
    100 100        
    100 100        
249             # A change.
250 49         98 push @{ $rec{changes} } => $arg;
  49         314  
251             } elsif ($config->get( key => "target.$arg.uri") || URI->new($arg)->isa('URI::db')) {
252             # A target. Instantiate and keep for subsequente change searches.
253 39         15300 $target = App::Sqitch::Target->new( @params, name => $arg );
254 38 50       5537 push @{ $rec{targets} } => $target unless $seen{$target->name}++;
  38         1350  
255             } elsif ($engines{$arg}) {
256             # An engine. Add its target.
257 21   66     6159 my $name = $config->get(key => "engine.$arg.target") || "db:$arg:";
258 21         4153 $target = App::Sqitch::Target->new( @params, name => $name );
259 21 50       2845 push @{ $rec{targets} } => $target unless $seen{$target->name}++;
  21         895  
260             } elsif (-e $arg) {
261             # Maybe it's a plan file?
262             %target_for = map {
263 7 50       2388 $_->plan_file => $_
  14         3174  
264             } reverse App::Sqitch::Target->all_targets(@params) unless %target_for;
265 7 100       3729 if ($target_for{$arg}) {
266             # It *is* a plan file.
267 6         113 $target = $target_for{$arg};
268 6 50       140 push @{ $rec{targets} } => $target unless $seen{$target->name}++;
  6         494  
269             } else {
270             # Nah, who knows.
271 1         3 push @{ $rec{unknown} } => $arg;
  1         5  
272             }
273             } else {
274             # Who knows?
275 78         21535 push @{ $rec{unknown} } => $arg;
  78         636  
276             }
277             }
278              
279             # Replace missing names with unknown values.
280 178 100       1267 my @names = map { $_ || shift @{ $rec{unknown} } } @{ $p{names} || [] };
  66 100       226  
  59         242  
  178         1081  
281              
282             # Die on unknowns.
283 178 100       356 if (my @unknown = @{ $rec{unknown} } ) {
  178         730  
284 21         141 hurl $self->command => __nx(
285             'Unknown argument "{arg}"',
286             'Unknown arguments: {arg}',
287             scalar @unknown,
288             arg => join ', ', @unknown
289             );
290             }
291              
292             # Figure out what targets to access. Use default unless --all.
293 157         303 my @targets = @{ $rec{targets} };
  157         537  
294 157 100       740 if ($p{all}) {
    100          
295             # Got --all.
296 12 100       348 hurl $self->command => __(
297             'Cannot specify both --all and engine, target, or plan arugments'
298             ) if @targets;
299 8         73 @targets = App::Sqitch::Target->all_targets(@params );
300             } elsif (!@targets) {
301             # Use all if tag.all is set, otherwise just the default.
302 65         544 my $key = $self->command . '.all';
303             @targets = $self->sqitch->config->get(key => $key, as => 'bool')
304             ? App::Sqitch::Target->all_targets(@params )
305 65 100       1941 : do {
306             # Fall back on the default unless it's invalid.
307 61 100       8617 die $deftarget_err if $deftarget_err;
308 60         213 ($target)
309             }
310             }
311              
312 152         2074 return (@names, \@targets, $rec{changes});
313             }
314              
315             sub _mkpath {
316 222     222   107961 my ( $self, $dir ) = @_;
317 222 100       16193 $self->debug( ' ', __x 'Created {file}', file => $dir )
318             if make_path $dir, { error => \my $err };
319              
320 222 100       51562 my $diag = shift @{ $err } or return $self;
  222         1170  
321              
322 2         6 my ( $path, $msg ) = %{ $diag };
  2         8  
323 2 100       15 hurl $self->command => __x(
324             'Error creating {path}: {error}',
325             path => $path,
326             error => $msg,
327             ) if $path;
328 1         8 hurl $self->command => $msg;
329             }
330              
331             1;
332              
333             __END__
334              
335             =head1 Name
336              
337             App::Sqitch::Command - Sqitch Command support
338              
339             =head1 Synopsis
340              
341             my $cmd = App::Sqitch::Command->load( deploy => \%params );
342             $cmd->run;
343              
344             =head1 Description
345              
346             App::Sqitch::Command is the base class for all Sqitch commands.
347              
348             =head1 Interface
349              
350             =head2 Constants
351              
352             =head3 C<ENGINES>
353              
354             Returns the list of supported engines, currently:
355              
356             =over
357              
358             =item * C<firebird>
359              
360             =item * C<mysql>
361              
362             =item * C<oracle>
363              
364             =item * C<pg>
365              
366             =item * C<sqlite>
367              
368             =item * C<vertica>
369              
370             =item * C<exasol>
371              
372             =item * C<snowflake>
373              
374             =item * C<cockroach>
375              
376             =item * C<clickhouse>
377              
378             =back
379              
380             =head2 Class Methods
381              
382             =head3 C<options>
383              
384             my @spec = App::Sqitch::Command->options;
385              
386             Returns a list of L<Getopt::Long> options specifications. When C<load> loads
387             the class, any options passed to the command will be parsed using these
388             values. The keys in the resulting hash will be the first part of each option,
389             with dashes converted to underscores. This hash will be passed to C<configure>
390             along with a L<App::Sqitch::Config> object for munging into parameters to be
391             passed to the constructor.
392              
393             Here's an example excerpted from the C<config> command:
394              
395             sub options {
396             return qw(
397             get
398             unset
399             list
400             global
401             system
402             config-file=s
403             );
404             }
405              
406             This will result in hash keys with the same names as each option except for
407             C<config-file=s>, which will be named C<config_file>.
408              
409             =head3 C<configure>
410              
411             my $params = App::Sqitch::Command->configure($config, $options);
412              
413             Takes two arguments, an L<App::Sqitch::Config> object and the hash of
414             command-line options as specified by C<options>. The returned hash should be
415             the result of munging these two objects into a hash reference of parameters to
416             be passed to the command subclass constructor.
417              
418             By default, this method converts dashes to underscores in command-line options
419             keys, and then merges the configuration values with the options, with the
420             command-line options taking priority. You may wish to override this method to
421             do something different.
422              
423             =head3 C<class_for>
424              
425             my $subclass = App::Sqitch::Command->subclass_for($sqitch, $cmd_name);
426              
427             This method attempts to load the subclass of App::Sqitch::Commmand that
428             corresponds to the command name. Returns C<undef> and sends errors to the
429             C<debug> method of the <$sqitch> object if no such subclass can
430             be loaded.
431              
432             =head2 Constructors
433              
434             =head3 C<load>
435              
436             my $cmd = App::Sqitch::Command->load( \%params );
437              
438             A factory method for instantiating Sqitch commands. It loads the subclass for
439             the specified command and calls C<create> to instantiate and return an
440             instance of the subclass. Sends error messages to the C<debug> method of the
441             C<sqitch> parameter and throws an exception if the subclass does not exist or
442             cannot be loaded. Supported parameters are:
443              
444             =over
445              
446             =item C<sqitch>
447              
448             The App::Sqitch object driving the whole thing.
449              
450             =item C<config>
451              
452             An L<App::Sqitch::Config> representing the current application configuration
453             state.
454              
455             =item C<command>
456              
457             The name of the command to be executed.
458              
459             =item C<args>
460              
461             An array reference of command-line arguments passed to the command.
462              
463             =back
464              
465             =head3 C<create>
466              
467             my $pkg = App::Sqitch::Command->class_for( $sqitch, $cmd_name )
468             or die "No such command $cmd_name";
469             my $cmd = $pkg->create({
470             sqitch => $sqitch,
471             config => $config,
472             args => \@ARGV,
473             });
474              
475             Creates and returns a new object for a subclass of App::Sqitch::Command. It
476             parses options from the C<args> parameter, calls C<configure> to merge
477             configuration with the options, and finally calls C<new> with the resulting
478             hash. Supported parameters are the same as for C<load> except for the
479             C<command> parameter, which will be ignored.
480              
481             =head3 C<new>
482              
483             my $cmd = App::Sqitch::Command->new(%params);
484              
485             Instantiates and returns a App::Sqitch::Command object. This method is not
486             designed to be overridden by subclasses; they should implement
487             L<C<BUILDARGS>|Moo::Manual::Construction/BUILDARGS> or
488             L<C<BUILD>|Moo::Manual::Construction/BUILD>, instead.
489              
490             =head2 Accessors
491              
492             =head3 C<sqitch>
493              
494             my $sqitch = $cmd->sqitch;
495              
496             Returns the L<App::Sqitch> object that instantiated the command. Commands may
497             access its properties in order to manage global state.
498              
499             =head2 Overridable Instance Methods
500              
501             These methods should be overridden by all subclasses.
502              
503             =head3 C<execute>
504              
505             $cmd->execute;
506              
507             Executes the command. This is the method that does the work of the command.
508             Must be overridden in all subclasses. Dies if the method is not overridden for
509             the object on which it is called, or if it is called against a base
510             App::Sqitch::Command object.
511              
512             =head3 C<command>
513              
514             my $command = $cmd->command;
515              
516             The name of the command. Defaults to the last part of the package name, so as
517             a rule you should not need to override it, since it is that string that Sqitch
518             uses to find the command class.
519              
520             =head2 Utility Instance Methods
521              
522             These methods are mainly provided as utilities for the command subclasses to
523             use.
524              
525             =head3 C<default_target>
526              
527             my $target = $cmd->default_target;
528              
529             This method returns the default target. It should only be used by commands
530             that don't use a C<parse_args()> to find and load a target.
531              
532             This method should always return a target option, never C<undef>. If the
533             C<core.engine> configuration option has been set, then the target will support
534             that engine. In the latter case, if C<engine.$engine.target> is set, that
535             value will be used. Otherwise, the returned target will have a URI of C<db:>
536             and no associated engine; the C<engine> method will throw an exception. This
537             behavior should be fine for commands that don't need to load the engine.
538              
539             =head3 C<parse_args>
540              
541             my ($name1, $name2, $targets, $changes) = $cmd->parse_args(
542             names => \@names,
543             target => $target_name,
544             args => \@args
545             );
546              
547             Examines each argument to determine whether it's a known change spec or
548             identifies a target or engine. Unrecognized arguments will replace false
549             values in the C<names> array reference. Any remaining unknown arguments will
550             trigger an error.
551              
552             Returns a list consisting all the desired names, followed by an array
553             reference of target objects and an array reference of change specs.
554              
555             This method is useful for commands that take a number of arguments where the
556             order may be mixed.
557              
558             The supported parameters are:
559              
560             =over
561              
562             =item C<args>
563              
564             An array reference of the command arguments.
565              
566             =item C<target>
567              
568             The name of a target, if any. Useful for commands that offer their own
569             C<--target> option. This target will be the default target, and the first
570             returned in the targets array.
571              
572             =item C<names>
573              
574             An array reference of names. If any is false, its place will be taken by an
575             otherwise unrecognized argument. The number of values in this array reference
576             determines the number of values returned as names in the return values. Such
577             values may still be false or undefined; it's up to the caller to decide what
578             to do about that.
579              
580             =item C<all>
581              
582             In the event that no targets are recognized (or changes that implicitly
583             recognize the default target), if this parameter is true, then all known
584             targets from the configuration will be returned.
585              
586             =item C<no_changes>
587              
588             If true, the parser will not check to see if any argument corresponds to a
589             change. The last value returned will be C<undef> instead of the usual array
590             reference. Any argument that might have been recognized as a change will
591             instead be included in either the C<targets> array -- if it's recognized as a
592             target -- or used to set names to return. Any remaining are considered
593             unknown arguments and will result in an exception.
594              
595             =back
596              
597             If a target parameter is passed, it will always be instantiated and returned
598             as the first item in the "target" array, and arguments recognized as changes
599             in the plan associated with that target will be returned as changes.
600              
601             If no target is passed or appears in the arguments, a default target will be
602             instantiated based on the command-line options and configuration. Unlike the
603             target returned by C<default_target>, this target B<must> have an associated
604             engine specified by the configuration. This is on the assumption that it will
605             be used by commands that require an engine to do their work. Of course, any
606             changes must be recognized from the plan associated with this target.
607              
608             Changes are only recognized if they're found in the plan of the target that
609             precedes them. If no target precedes them, the target specified by the
610             C<target> parameter or the default target will be searched. Such changes can
611             be specified in any way documented in L<sqitchchanges>.
612              
613             Targets may be recognized by any one of these types of arguments:
614              
615             =over
616              
617             =item * Target Name
618              
619             =item * Database URI
620              
621             =item * Engine Name
622              
623             =item * Plan File
624              
625             =back
626              
627             In the case of plan files, C<parse_args()> will return the first target it
628             finds for that plan file, even if multiple targets use the same plan file. The
629             order of precedence for this determination is the default project target,
630             followed by named targets, then engine targets.
631              
632             =head3 C<target_params>
633              
634             my $target = App::Sqitch::Target->new( $cmd->target_params );
635              
636             Returns a list of parameters suitable for passing to the C<new> or
637             C<all_targets> constructors of App::Sqitch::Target.
638              
639             =head3 C<run>
640              
641             $cmd->run('echo hello');
642              
643             Runs a system command and waits for it to finish. Throws an exception on
644             error.
645              
646             =head3 C<capture>
647              
648             my @files = $cmd->capture(qw(ls -lah));
649              
650             Runs a system command and captures its output to C<STDOUT>. Returns the output
651             lines in list context and the concatenation of the lines in scalar context.
652             Throws an exception on error.
653              
654             =head3 C<probe>
655              
656             my $git_version = $cmd->capture(qw(git --version));
657              
658             Like C<capture>, but returns just the C<chomp>ed first line of output.
659              
660             =head3 C<verbosity>
661              
662             my $verbosity = $cmd->verbosity;
663              
664             Returns the verbosity level.
665              
666             =head3 C<trace>
667              
668             Send trace information to C<STDOUT> if the verbosity level is 3 or higher.
669             Trace messages will have C<trace: > prefixed to every line. If it's lower than
670             3, nothing will be output.
671              
672             =head3 C<debug>
673              
674             $cmd->debug('Found snuggle in the crib.');
675              
676             Send debug information to C<STDOUT> if the verbosity level is 2 or higher.
677             Debug messages will have C<debug: > prefixed to every line. If it's lower than
678             2, nothing will be output.
679              
680             =head3 C<info>
681              
682             $cmd->info('Nothing to deploy (up-to-date)');
683              
684             Send informational message to C<STDOUT> if the verbosity level is 1 or higher,
685             which, by default, it is. Should be used for normal messages the user would
686             normally want to see. If verbosity is lower than 1, nothing will be output.
687              
688             =head3 C<comment>
689              
690             $cmd->comment('On database flipr_test');
691              
692             Send comments to C<STDOUT> if the verbosity level is 1 or higher, which, by
693             default, it is. Comments have C<# > prefixed to every line. If verbosity is
694             lower than 1, nothing will be output.
695              
696             =head3 C<emit>
697              
698             $cmd->emit('core.editor=emacs');
699              
700             Send a message to C<STDOUT>, without regard to the verbosity. Should be used
701             only if the user explicitly asks for output, such as for
702             C<sqitch config --get core.editor>.
703              
704             =head3 C<vent>
705              
706             $cmd->vent('That was a misage.');
707              
708             Send a message to C<STDERR>, without regard to the verbosity. Should be used
709             only for error messages to be printed before exiting with an error, such as
710             when reverting failed changes.
711              
712             =head3 C<page>
713              
714             $sqitch->page('Search results:');
715              
716             Like C<emit()>, but sends the output to a pager handle rather than C<STDOUT>.
717             Unless there is no TTY (such as when output is being piped elsewhere), in
718             which case it I<is> sent to C<STDOUT>. Meant to be used to send a lot of data
719             to the user at once, such as when display the results of searching the event
720             log:
721              
722             $iter = $engine->search_events;
723             while ( my $change = $iter->() ) {
724             $cmd->page(join ' - ', @{ $change }{ qw(change_id event change) });
725             }
726              
727             =head3 C<warn>
728              
729             $cmd->warn('Could not find nerble; using nobble instead.');
730              
731             Send a warning messages to C<STDERR>. Warnings will have C<warning: > prefixed
732             to every line. Use if something unexpected happened but you can recover from
733             it.
734              
735             =head3 C<usage>
736              
737             $cmd->usage('Missing "value" argument');
738              
739             Sends the specified message to C<STDERR>, followed by the usage sections of
740             the command's documentation. Those sections may be named "Name", "Synopsis",
741             or "Options". Any or all of these will be shown. The doc used to display them
742             will be the first found of:
743              
744             =over
745              
746             =item C<sqitch-$command-usage>
747              
748             =item C<sqitch-$command>
749              
750             =item C<sqitch>
751              
752             =item C<App::Sqitch::Command::$command>
753              
754             =item C<App::Sqitch::Command>
755              
756             =back
757              
758             For an ideal usage messages, C<sqitch-$command-usage.pod> should be created by
759             all command subclasses.
760              
761             =head1 See Also
762              
763             =over
764              
765             =item L<sqitch>
766              
767             The Sqitch command-line client.
768              
769             =back
770              
771             =head1 Author
772              
773             David E. Wheeler <david@justatheory.com>
774              
775             =head1 License
776              
777             Copyright (c) 2012-2026 David E. Wheeler, 2012-2021 iovation Inc.
778              
779             Permission is hereby granted, free of charge, to any person obtaining a copy
780             of this software and associated documentation files (the "Software"), to deal
781             in the Software without restriction, including without limitation the rights
782             to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
783             copies of the Software, and to permit persons to whom the Software is
784             furnished to do so, subject to the following conditions:
785              
786             The above copyright notice and this permission notice shall be included in all
787             copies or substantial portions of the Software.
788              
789             THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
790             IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
791             FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
792             AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
793             LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
794             OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
795             SOFTWARE.
796              
797             =cut