1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
# ABSTRACT: mark the default stack
package App::Pinto::Command::default;
use strict;
use warnings;
#-----------------------------------------------------------------------------
use base 'App::Pinto::Command';
#------------------------------------------------------------------------------
our $VERSION = '0.097'; # VERSION
#------------------------------------------------------------------------------
sub opt_spec {
my ( $self, $app ) = @_;
return ( [ 'none' => 'Unmark the default stack' ] );
}
#-----------------------------------------------------------------------------
sub validate_args {
my ( $self, $opts, $args ) = @_;
$self->usage_error('Cannot specify multiple stacks')
if @{$args} > 1;
$self->usage_error('Must specify a STACK or --none')
if !( @{$args} xor $opts->{none} );
return 1;
}
#------------------------------------------------------------------------------
sub execute {
my ( $self, $opts, $args ) = @_;
$opts->{stack} = $args->[0] if $args->[0];
my $result = $self->pinto->run( $self->action_name, %{$opts} );
return $result->exit_status;
}
#------------------------------------------------------------------------------
1;
__END__
=pod
=encoding UTF-8
=for :stopwords Jeffrey Ryan Thalhammer unmark unmarks
=head1 NAME
App::Pinto::Command::default - mark the default stack
=head1 VERSION
version 0.097
=head1 SYNOPSIS
pinto --root=REPOSITORY_ROOT default [OPTIONS] [STACK]
=head1 DESCRIPTION
This command marks the given C<STACK> as the default stack for the
repository. The existing default stack (if one exists) is thereby
unmarked. The default stack is used by most L<pinto> commands where a
stack is not explicitly specified either by option or argument.
If the C<--none> option is given instead of a C<STACK> argument, then
the default stack is unmarked (if one exists). When a repository has
no default stack, you will have to explicitly specify the stack
as option or argument for most L<pinto> commands.
Use the L<stacks|App::Pinto::Command::stacks> command to list the
stacks that currently exist in the repository and show which one is
the default.
=head1 BEWARE
Think carefully before changing the default stack. This will
dramatically affect all users of the repository, so it is wise to
notify them well in advance.
=head1 COMMAND ARGUMENTS
The argument is the name of the stack you wish to mark as the default.
The stack must already exist. A stack argument cannot be used when the
C<--none> option is specified.
=head1 COMMAND OPTIONS
=over 4
=item --none
Unmarks the default stack (if one exists). This option cannot be used
when the C<STACK> argument is specified.
=back
=head1 AUTHOR
Jeffrey Ryan Thalhammer <jeff@stratopan.com>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Jeffrey Ryan Thalhammer.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|