App-Notes

 view release on metacpan or  search on metacpan

bin/notes  view on Meta::CPAN

    return if not $c->is_command($cmd) or $cmd ~~ [qw( help init sync )];
    sync( $c, pull_only => 1 ) if auto_sync();
}

sub post_process {
    my ( $c ) = @_;
    my $cmd = $c->cmd;
    if($c->is_command($cmd) and not $cmd ~~ [qw( help init list show sync )]) {
        sync( $c, push_only => 1 ) if auto_sync();
    }
    say $c->output if $c->output;
}

sub invalid {
    my ( $c ) = @_;
    my $cmd = $c->cmd;
    ($cmd) = grep { /^$cmd/ } $c->commands;
    $cmd ? $c->execute( $cmd ) : $c->execute( 'help' );
    return; # This makes the command name not be printed from the last line
}

bin/notes  view on Meta::CPAN


sub init {
    my ( $c ) = @_;

    die "Notes dir already exists!" if -d notes_dir();

    my $dir = notes_dir();
    my $repo = $ARGV[0];
    my $output = capture {
        if( $repo ) {
            say "Initializing notes from $repo...";
            Git::Repository->run( clone => $repo, $dir->stringify );
        } else {
            say "Initializing notes ($dir)...";
            print Git::Repository->run( init => $dir->stringify );
        }
    }
}

sub list {
    my ( $c ) = @_;
    my $search = @ARGV > 0 ? join ' ', @ARGV : undef;
    my $notes = find_notes( $c, search => get_filename( $search ) );
    say $_->basename for @$notes;
    return;
}

sub rename {
    my ( $c ) = @_;
    my $cmd = $c->cmd;
    die "usage: $0 $cmd <orig_name> <new_name>\n" unless @ARGV == 2;
    my ($orig_name, $new_name) = @ARGV;
    my $notes = find_notes( $c, search => get_filename( $orig_name ) );
    die "No such note [$orig_name]" unless @$notes;



( run in 0.560 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )