« auto/share/dist/Setup-Project/tmpl/ShareDir/lib/__PACKAGE__/Flavor/__FLAVOR_NAME__.pm
↑ Summary
Setup/Project/ShareDir.pm »
| 1 | package Setup::Project::CLI; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use parent 'Exporter'; | ||
| 5 | |||
| 6 | our @EXPORT = qw/ | ||
| 7 | usage | ||
| 8 | /; | ||
| 9 | |||
| 10 | use Class::Accessor::Lite ( | ||
| 11 | rw => [qw/version/] | ||
| 12 | ); | ||
| 13 | |||
| 14 | use Getopt::Compact::WithCmd; | ||
| 15 | use Setup::Project; | ||
| 16 | |||
| 17 | sub new { | ||
| 18 | my $class = shift; | ||
| 19 | my $go = Getopt::Compact::WithCmd->new( | ||
| 20 | global_struct => { | ||
| 21 | 'distdir' => { | ||
| 22 | alias => 'd', | ||
| 23 | type => 'Str', | ||
| 24 | desc => 'dist dir', | ||
| 25 | opts => { | ||
| 26 | required => 1, | ||
| 27 | }, | ||
| 28 | }, | ||
| 29 | }, | ||
| 30 | ); | ||
| 31 | |||
| 32 | bless { | ||
| 33 | go => $go, | ||
| 34 | argv => \@ARGV, | ||
| 35 | }, $class; | ||
| 36 | } | ||
| 37 | |||
| 38 | sub argv { | ||
| 39 | my $self = shift; | ||
| 40 | return $self->{argv}; | ||
| 41 | } | ||
| 42 | |||
| 43 | sub maker { | ||
| 44 | my ($self, %args) = @_; | ||
| 45 | |||
| 46 | my $maker = Setup::Project->new( | ||
| 47 | tmpl_dir => $args{tmpl_dir}, | ||
| 48 | write_dir => $self->{go}->opts->{distdir}, | ||
| 49 | ); | ||
| 50 | } | ||
| 51 | |||
| 52 | sub usage { | ||
| 53 | my $msg = shift; | ||
| 54 | print("usage: $0 -d /tmp/distdir $msg \n"); | ||
| 55 | exit -1; | ||
| 56 | } | ||
| 57 | |||
| 58 | 1; |