App-BitBucketCli

 view release on metacpan or  search on metacpan

bin/bb-cli  view on Meta::CPAN

#!/usr/bin/perl

# Created on: 2017-04-24 08:14:56
# Create by:  Ivan Wills
# $Id$
# $Revision$, $HeadURL$, $Date$
# $Revision$, $Source$, $Date$

use strict;
use warnings;
use Getopt::Alt;
use Data::Dumper qw/Dumper/;
use English qw/ -no_match_vars /;
use FindBin qw/$Bin/;
use YAML::Syck qw/LoadFile DumpFile/;
use Path::Tiny;

our $VERSION = 0.009;
my ($name)   = $PROGRAM_NAME =~ m{^.*/(.*?)$}mxs;

exit main();

sub main {
    my @common = (
        'colors|c=s%',
        'force|f!',
        'host|h=s',
        'long|l',
        'max|M=i',
        'password|P=s',
        'project|p=s',
        'regexp|R',
        'remote|m=s',
        'repository|r=s',
        'sleep|s=i',
        'test|T!',
        'username|U=s',
        'verbose|v+',
    );
    my ($options, $cmd, $opt) = get_options(
        {
            name        => 'bb-cli',
            conf_prefix => '.',
            helper      => 1,
            default     => {
                remote => 'origin',
                colors => {
                    aborted  => 'grey18 on_grey0',
                    disabled => 'grey22',
                    notbuilt => 'grey12',
                },
            },
            sub_command   => sub_commands(),
            help_packages => sub_commands_help(),
            auto_complete => sub {
                my ($option, $auto, $errors) = @_;
                my $sub_command = $option->cmd;
                if ( $sub_command eq '--' ) {
                    warn '--';
                }
                elsif ( ! $sub_command || $sub_command eq $name  || $sub_command eq $0 ) {
                    my $part = shift @ARGV;
                    print join "\n", (
                        grep { $part ? /$part/ : 1 }
                        sort keys %{ sub_commands() }
                    ), '';
                }
                else {
                    warn Dumper $sub_command, \@ARGV, $0;
                }
            },
        },



( run in 0.639 second using v1.01-cache-2.11-cpan-39bf76dae61 )