1 package # hide from PAUSE
2 DBIx::Class::Admin::Usage;
5 use base 'Getopt::Long::Descriptive::Usage';
7 use base 'Class::Accessor::Grouped';
11 __PACKAGE__->mk_group_accessors('simple', 'synopsis', 'short_description');
14 Getopt::Long::Descriptive::prog_name();
18 my ($self,$field, $value) = @_;
19 my $prog_name = prog_name();
20 $value =~ s/%c/$prog_name/g;
21 $self->next::method($field, $value);
27 This returns the usage formated as a pod document
34 return join qq{\n}, $self->pod_leader_text, $self->pod_option_text, $self->pod_authorlic_text;
40 return qq{=head1 NAME\n\n}.prog_name()." - ".$self->short_description().qq{\n\n}.
41 qq{=head1 SYNOPSIS\n\n}.$self->leader_text().qq{\n}.$self->synopsis().qq{\n\n};
45 sub pod_authorlic_text {
50 See L<DBIx::Class/CONTRIBUTORS>
54 You may distribute this code under the same terms as Perl itself
61 my @options = @{ $self->{options} || [] };
63 return $string unless @options;
65 $string .= "=head1 OPTIONS\n\n=over\n\n";
67 foreach my $opt (@options) {
68 my $spec = $opt->{spec};
69 my $desc = $opt->{desc};
70 if ($desc eq 'spacer') {
71 $string .= "=back\n\n=head2 $spec\n\n=cut\n\n=over\n\n";
75 $spec = Getopt::Long::Descriptive->_strip_assignment($spec);
76 $string .= "=item " . join " or ", map { length > 1 ? "B<--$_>" : "B<-$_>" }
78 $string .= "\n\n$desc\n\n=cut\n\n";
81 $string .= "=back\n\n";