App-BitBucketCli

 view release on metacpan or  search on metacpan

TODO.md  view on Meta::CPAN

# TODO

* Need to document that if global host/user/password set then that is the only
server that can be accessed without command line parameters.

* Move individual commands to their own Modules

  1. ~~Need to work out how to best handle sub-commands~~
  1. ~~Should still be able to auto complete commands~~
  1. Change the organisation of code in other ways?

bin/bb-cli  view on Meta::CPAN


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(

bin/bb-cli  view on Meta::CPAN

    $options = set_defaults($options);

    # do stuff here
    my $module = 'App::BitBucketCli::Command::' . join '', map {ucfirst $_} split /-/, $cmd;
    my $file = "$module.pm";
    $file =~ s/::/\//g;
    require $file;
    my $bbs = $module->new(
        host => $options->{host},
        user => $options->{username},
        pass => $options->{password},
        max  => $options->{max},
        opt  => $options,
    );

    $cmd =~ s/-/_/g;
    return $bbs->$cmd(@ARGV) || 0;
}

sub set_defaults {
    my ($opt) = @_;

bin/bb-cli  view on Meta::CPAN


                $opt->{host}       ||= $host;
                $opt->{project}    ||= $project;
                $opt->{repository} ||= $repo;
            }
        }
    }

    $opt->{host}     ||= $config->{host};
    $opt->{username} ||= $config->{user};
    $opt->{password} ||= $config->{pass};

    return $opt;
}

sub sub_commands_help {
    my ($self) = @_;
    my %help;

    for my $cmd (keys %{sub_commands()}) {
        my $module = 'App::BitBucketCli::Command::' . join '', map {ucfirst $_} split /-/, $cmd;

bin/bb-cli  view on Meta::CPAN

  -R --regexp[=]str ??
  -m --remote[=]str ??
  -r --repository[=]str
                    For commands that work on repositories this contains the repository
  -s --sleep[=]seconds
                    ??
  -t --test         ??

 CONFIGURATION:
  -h --host[=]str   Specify the Stash/Bitbucket Servier host name
  -P --password[=]str
                    The password to connect to the server as
  -u --username[=]str
                    The username to connect to the server as

  -v --verbose       Show more detailed option
     --version       Prints the version information
     --help          Prints this help information
     --man           Prints the full documentation for bb-cli

=head1 DESCRIPTION

lib/App/BitBucketCli/Command/Branches.pm  view on Meta::CPAN

  -R --regexp[=]str ??
  -m --remote[=]str ??
  -r --repository[=]str
                    For commands that work on repositories this contains the repository
  -s --sleep[=]seconds
                    ??
  -t --test         ??

 CONFIGURATION:
  -h --host[=]str   Specify the Stash/Bitbucket Servier host name
  -P --password[=]str
                    The password to connect to the server as
  -u --username[=]str
                    The username to connect to the server as

  -v --verbose       Show more detailed option
     --version       Prints the version information
     --help          Prints this help information
     --man           Prints the full documentation for bb-cli

=head1 DESCRIPTION

lib/App/BitBucketCli/Command/Projects.pm  view on Meta::CPAN

  -R --regexp[=]str ??
  -m --remote[=]str ??
  -r --repository[=]str
                    For commands that work on repositories this contains the repository
  -s --sleep[=]seconds
                    ??
  -t --test         ??

 CONFIGURATION:
  -h --host[=]str   Specify the Stash/Bitbucket Servier host name
  -P --password[=]str
                    The password to connect to the server as
  -u --username[=]str
                    The username to connect to the server as

  -v --verbose       Show more detailed option
     --version       Prints the version information
     --help          Prints this help information
     --man           Prints the full documentation for bb-cli

=head1 DESCRIPTION

lib/App/BitBucketCli/Command/PullRequests.pm  view on Meta::CPAN

                    Show only pull requests to this branch
  -f --from-branch[=](regex|branch)
                    Show only pull requests from this branchx
  -T --title[=]regex
                    Show only pull requests matching this title
  -S --state[=](OPEN|MERGED|DECLINED|ALL)
                    Show pull requests of this type (Default OPEN)

 CONFIGURATION:
  -h --host[=]str   Specify the Stash/Bitbucket Servier host name
  -P --password[=]str
                    The password to connect to the server as
  -u --username[=]str
                    The username to connect to the server as

  -v --verbose       Show more detailed option
     --version       Prints the version information
     --help          Prints this help information
     --man           Prints the full documentation for bb-cli

=head1 DESCRIPTION

lib/App/BitBucketCli/Command/Repositories.pm  view on Meta::CPAN

  -R --regexp[=]str ??
  -m --remote[=]str ??
  -r --repository[=]str
                    For commands that work on repositories this contains the repository
  -s --sleep[=]seconds
                    ??
  -t --test         ??

 CONFIGURATION:
  -h --host[=]str   Specify the Stash/Bitbucket Servier host name
  -P --password[=]str
                    The password to connect to the server as
  -u --username[=]str
                    The username to connect to the server as

  -v --verbose       Show more detailed option
     --version       Prints the version information
     --help          Prints this help information
     --man           Prints the full documentation for bb-cli

=head1 DESCRIPTION

lib/App/BitBucketCli/Command/Repository.pm  view on Meta::CPAN

  -R --regexp[=]str ??
  -m --remote[=]str ??
  -r --repository[=]str
                    For commands that work on repositories this contains the repository
  -s --sleep[=]seconds
                    ??
  -t --test         ??

 CONFIGURATION:
  -h --host[=]str   Specify the Stash/Bitbucket Servier host name
  -P --password[=]str
                    The password to connect to the server as
  -u --username[=]str
                    The username to connect to the server as

  -v --verbose       Show more detailed option
     --version       Prints the version information
     --help          Prints this help information
     --man           Prints the full documentation for bb-cli

=head1 DESCRIPTION



( run in 0.756 second using v1.01-cache-2.11-cpan-49f99fa48dc )