App-MiseEnPlace

 view release on metacpan or  search on metacpan

lib/App/MiseEnPlace.pm  view on Meta::CPAN

package App::MiseEnPlace;
our $AUTHORITY = 'cpan:GENEHACK';
$App::MiseEnPlace::VERSION = '0.170';
# ABSTRACT: A place for everything and everything in its place


use strict;
use warnings;
use 5.010;

use base 'App::Cmd::Simple';
use autodie;
use Carp;
use File::HomeDir;
use Path::Tiny;
use Term::ANSIColor;
use Try::Tiny;
use Types::Standard -types;
use YAML qw/ LoadFile /;

use Moo;
use MooX::HandlesVia;

has bindir => (
  is      => 'rw' ,
  isa     => Str ,
  lazy    => 1 ,
  default => sub { path( File::HomeDir->my_home , 'bin' )->stringify } ,
);

has config_file => (
  is      => 'rw' ,
  isa     => Str ,
  lazy    => 1 ,
  default => sub { path( File::HomeDir->my_home() , '.mise' )->stringify() } ,
);

has 'directories' => (
  is          => 'rw' ,
  isa         => ArrayRef[Str] ,
  handles_via => 'Array' ,
  handles     => { all_directories => 'elements' } ,
);

has 'homedir' => (
  is      => 'rw' ,
  isa     => Str ,
  lazy    => 1 ,
  default => sub { path( File::HomeDir->my_home )->stringify() } ,
);

has 'links' => (
  is          => 'rw' ,
  isa         => ArrayRef[ArrayRef[Str]] ,
  handles_via => 'Array' ,
  handles     => { all_links => 'elements' } ,
);

has 'verbose' => (
  is      => 'rw' ,
  isa     => Bool ,
  default => 0 ,
);

sub opt_spec {
  return (
    [ 'config|C=s'         => 'config file location (default = ~/.mise)' ] ,
    [ 'remove-bin-links|R' => 'remove all links from ~/bin at beginning of run' ] ,
    [ 'verbose|v'          => 'be verbose' ] ,
    [ 'version|V'          => 'show version' ] ,
  );
}

sub validate_args {
  my( $self , $opt , $args ) = @_;

  $self->usage_error( "No args needed" ) if @$args;



( run in 2.078 seconds using v1.01-cache-2.11-cpan-8f98c5d2c55 )