API-CLI

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN

                            Preamble

  The license agreements of most software companies try to keep users
at the mercy of those companies.  By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

LICENSE  view on Meta::CPAN

Program or a portion of it, either verbatim or with modifications.  Each
licensee is addressed as "you".

  1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program.  You may charge a fee for the physical act of
transferring a copy.

  2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:

    a) cause the modified files to carry prominent notices stating that
    you changed the files and the date of any change; and

    b) cause the whole of any work that you distribute or publish, that
    in whole or in part contains the Program or any part thereof, either

LICENSE  view on Meta::CPAN


    c) If the modified program normally reads commands interactively when
    run, you must cause it, when started running for such interactive use
    in the simplest and most usual way, to print or display an
    announcement including an appropriate copyright notice and a notice
    that there is no warranty (or else, saying that you provide a
    warranty) and that users may redistribute the program under these
    conditions, and telling the user how to view a copy of this General
    Public License.

    d) You may charge a fee for the physical act of transferring a
    copy, and you may at your option offer warranty protection in
    exchange for a fee.

Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.

  3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:

LICENSE  view on Meta::CPAN

    years, to give any third party free (except for a nominal charge
    for the cost of distribution) a complete machine-readable copy of the
    corresponding source code, to be distributed under the terms of
    Paragraphs 1 and 2 above; or,

    c) accompany it with the information you received as to where the
    corresponding source code may be obtained.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form alone.)

Source code for a work means the preferred form of the work for making
modifications to it.  For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.

  4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer

dist.ini  view on Meta::CPAN

copyright_year   = 2016

version = 0.001

[@Filter]
-bundle = @Basic
-remove = GatherDir
option = for_basic

[AutoPrereqs]
[OverridePkgVersion]
[MetaProvides::Package]
[Test::Compile]
filename = t/00.compile.t

[CopyFilesFromBuild]
copy = Makefile.PL
; requires CopyFilesFromBuild >= 0.163040
copy = t/00.compile.t

[GatherDir]

examples/bash/digitaloceancl.bash  view on Meta::CPAN

            2)
                __comp_current_options || return
                __digitaloceancl_dynamic_comp 'commands' 'generate'$'\t''Generate self completion'

            ;;
            *)
            # subcmds
            case ${MYWORDS[2]} in
              generate)
                FLAGS+=('--zsh' 'for zsh' '--bash' 'for bash')
                OPTIONS+=('--name' 'name of the program (optional, override name in spec)')
                __digitaloceancl_handle_options_flags
                  case $INDEX in
                  *)
                    __comp_current_options true || return # after parameters
                    case ${MYWORDS[$INDEX-1]} in
                      --data-file)
                      ;;
                      --name)
                      ;;

examples/bash/githubcl.bash  view on Meta::CPAN

            2)
                __comp_current_options || return
                __githubcl_dynamic_comp 'commands' 'generate'$'\t''Generate self completion'

            ;;
            *)
            # subcmds
            case ${MYWORDS[2]} in
              generate)
                FLAGS+=('--zsh' 'for zsh' '--bash' 'for bash')
                OPTIONS+=('--name' 'name of the program (optional, override name in spec)')
                __githubcl_handle_options_flags
                  case $INDEX in
                  *)
                    __comp_current_options true || return # after parameters
                    case ${MYWORDS[$INDEX-1]} in
                      --data-file)
                      ;;
                      --name)
                      ;;

examples/bash/metacpancl.bash  view on Meta::CPAN

            2)
                __comp_current_options || return
                __metacpancl_dynamic_comp 'commands' 'generate'$'\t''Generate self completion'

            ;;
            *)
            # subcmds
            case ${MYWORDS[2]} in
              generate)
                FLAGS+=('--zsh' 'for zsh' '--bash' 'for bash')
                OPTIONS+=('--name' 'name of the program (optional, override name in spec)')
                __metacpancl_handle_options_flags
                  case $INDEX in
                  *)
                    __comp_current_options true || return # after parameters
                    case ${MYWORDS[$INDEX-1]} in
                      --data-file)
                      ;;
                      --name)
                      ;;

examples/githubcl-appspec.yaml  view on Meta::CPAN

          type: integer
        public_repos:
          type: integer
        type:
          type: string
        url:
          type: string
      type: object
    organizationAsTeamMember:
      properties:
        errors:
          items:
            properties:
              code:
                type: string
              field:
                type: string
              resource:
                type: string
            type: object
          type: array

examples/githubcl-appspec.yaml  view on Meta::CPAN

              API rate limit exceeded. See http://developer.github.com/v3/#rate-limiting
              for details.
          '405':
            description: Response if merge cannot be performed.
            schema:
              $ref: '#/definitions/merge'
    /repos/{owner}/{repo}/readme:
      get:
        description: |
          Get the README.
          This method returns the preferred README for a repository.
        parameters:
        - description: Name of repository owner.
          in: path
          name: owner
          required: true
          type: string
        - description: Name of repository.
          in: path
          name: repo
          required: true

examples/githubcl-appspec.yaml  view on Meta::CPAN

  produces:
  - application/json
  schemes:
  - https
  securityDefinitions:
    oauth_2_0:
      authorizationUrl: https://github.com/login/oauth/authorize
      description: |
        OAuth2 is a protocol that lets external apps request authorization to private
        details in a user's GitHub account without getting their password. This is
        preferred over Basic Authentication because tokens can be limited to specific
        types of data, and can be revoked by users at any time.
      flow: accessCode
      scopes:
        admin:org: ''
        admin:org_hook: ''
        admin:public_key: ''
        admin:repo_hook: ''
        delete_repo: ''
        gist: ''
        notifications: ''

examples/githubcl-openapi.yaml  view on Meta::CPAN

consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  oauth_2_0:
    authorizationUrl: 'https://github.com/login/oauth/authorize'
    description: |
      OAuth2 is a protocol that lets external apps request authorization to private
      details in a user's GitHub account without getting their password. This is
      preferred over Basic Authentication because tokens can be limited to specific
      types of data, and can be revoked by users at any time.
    flow: accessCode
    scopes:
      'admin:org': ''
      'admin:org_hook': ''
      'admin:public_key': ''
      'admin:repo_hook': ''
      delete_repo: ''
      gist: ''
      notifications: ''

examples/githubcl-openapi.yaml  view on Meta::CPAN

            API rate limit exceeded. See http://developer.github.com/v3/#rate-limiting
            for details.
        '405':
          description: Response if merge cannot be performed.
          schema:
            $ref: '#/definitions/merge'
  '/repos/{owner}/{repo}/readme':
    get:
      description: |
        Get the README.
        This method returns the preferred README for a repository.
      parameters:
        - description: Name of repository owner.
          in: path
          name: owner
          required: true
          type: string
        - description: Name of repository.
          in: path
          name: repo
          required: true

examples/githubcl-openapi.yaml  view on Meta::CPAN

        type: integer
      public_repos:
        type: integer
      type:
        type: string
      url:
        type: string
    type: object
  organizationAsTeamMember:
    properties:
      errors:
        items:
          properties:
            code:
              type: string
            field:
              type: string
            resource:
              type: string
          type: object
        type: array

examples/html/digitaloceancl.html  view on Meta::CPAN

<p>Shell completion functions</p>

<h3 id="meta-completion-generate">_meta completion generate</h3>

<pre><code>    digitaloceancl _meta completion generate [options]</code></pre>

<p>Generate self completion</p>

<p>Options:</p>

<pre><code>    --name    name of the program (optional, override name in spec)
    --zsh     for zsh (flag)                                       
    --bash    for bash (flag)                                      </code></pre>

<h3 id="meta-pod">_meta pod</h3>

<pre><code>    digitaloceancl _meta pod &lt;subcommands&gt;</code></pre>

<p>Pod documentation</p>

<h3 id="meta-pod-generate">_meta pod generate</h3>

examples/html/githubcl.html  view on Meta::CPAN

<p>Shell completion functions</p>

<h3 id="meta-completion-generate">_meta completion generate</h3>

<pre><code>    githubcl _meta completion generate [options]</code></pre>

<p>Generate self completion</p>

<p>Options:</p>

<pre><code>    --name    name of the program (optional, override name in spec)
    --zsh     for zsh (flag)                                       
    --bash    for bash (flag)                                      </code></pre>

<h3 id="meta-pod">_meta pod</h3>

<pre><code>    githubcl _meta pod &lt;subcommands&gt;</code></pre>

<p>Pod documentation</p>

<h3 id="meta-pod-generate">_meta pod generate</h3>

examples/html/metacpancl.html  view on Meta::CPAN

<p>Shell completion functions</p>

<h3 id="meta-completion-generate">_meta completion generate</h3>

<pre><code>    metacpancl _meta completion generate [options]</code></pre>

<p>Generate self completion</p>

<p>Options:</p>

<pre><code>    --name    name of the program (optional, override name in spec)
    --zsh     for zsh (flag)                                       
    --bash    for bash (flag)                                      </code></pre>

<h3 id="meta-pod">_meta pod</h3>

<pre><code>    metacpancl _meta pod &lt;subcommands&gt;</code></pre>

<p>Pod documentation</p>

<h3 id="meta-pod-generate">_meta pod generate</h3>

examples/pod/digitaloceancl.pod  view on Meta::CPAN



=head3 _meta completion generate

    digitaloceancl _meta completion generate [options]

Generate self completion

Options:

    --name    name of the program (optional, override name in spec)
    --zsh     for zsh (flag)                                       
    --bash    for bash (flag)                                      


=head3 _meta pod

    digitaloceancl _meta pod <subcommands>

Pod documentation

examples/pod/githubcl.pod  view on Meta::CPAN



=head3 _meta completion generate

    githubcl _meta completion generate [options]

Generate self completion

Options:

    --name    name of the program (optional, override name in spec)
    --zsh     for zsh (flag)                                       
    --bash    for bash (flag)                                      


=head3 _meta pod

    githubcl _meta pod <subcommands>

Pod documentation

examples/pod/metacpancl.pod  view on Meta::CPAN



=head3 _meta completion generate

    metacpancl _meta completion generate [options]

Generate self completion

Options:

    --name    name of the program (optional, override name in spec)
    --zsh     for zsh (flag)                                       
    --bash    for bash (flag)                                      


=head3 _meta pod

    metacpancl _meta pod <subcommands>

Pod documentation

examples/zsh/_digitaloceancl  view on Meta::CPAN

                                    '1: :->cmd1' \
                                    '2: :->cmd2' \
                                    '3: :->cmd3' \
                                    '--data-file[File with data for POST/PUT/PATCH/DELETE requests]:data-file:_files' \
                                    '--debug[debug]' \
                                    '-d[debug]' \
                                    '--verbose[verbose]' \
                                    '-v[verbose]' \
                                    '--help[Show command help]' \
                                    '-h[Show command help]' \
                                    '--name[name of the program (optional, override name in spec)]:name' \
                                    '--zsh[for zsh]' \
                                    '--bash[for bash]' \
                                    && ret=0


                            ;;
                            esac

                        ;;

examples/zsh/_githubcl  view on Meta::CPAN

                                    '1: :->cmd1' \
                                    '2: :->cmd2' \
                                    '3: :->cmd3' \
                                    '--data-file[File with data for POST/PUT/PATCH/DELETE requests]:data-file:_files' \
                                    '--debug[debug]' \
                                    '-d[debug]' \
                                    '--verbose[verbose]' \
                                    '-v[verbose]' \
                                    '--help[Show command help]' \
                                    '-h[Show command help]' \
                                    '--name[name of the program (optional, override name in spec)]:name' \
                                    '--zsh[for zsh]' \
                                    '--bash[for bash]' \
                                    && ret=0


                            ;;
                            esac

                        ;;

examples/zsh/_metacpancl  view on Meta::CPAN

                                    '1: :->cmd1' \
                                    '2: :->cmd2' \
                                    '3: :->cmd3' \
                                    '--data-file[File with data for POST/PUT/PATCH/DELETE requests]:data-file:_files' \
                                    '--debug[debug]' \
                                    '-d[debug]' \
                                    '--verbose[verbose]' \
                                    '-v[verbose]' \
                                    '--help[Show command help]' \
                                    '-h[Show command help]' \
                                    '--name[name of the program (optional, override name in spec)]:name' \
                                    '--zsh[for zsh]' \
                                    '--bash[for bash]' \
                                    && ret=0


                            ;;
                            esac

                        ;;

lib/API/CLI.pm  view on Meta::CPAN

            open my $fh, '<', $data_file or die "Could not open '$data_file': $!";
            my $data = do { local $/; <$fh> };
            close $fh;
            $REQ->content($data);
        }
    }

    my ($ok, $out, $content) = $REQ->request;
    if (defined $out) {
        unless ($ok) {
            $out = $run->error($out);
        }
        warn $out;
    }
    say $content;

}

1;

__END__

lib/apicli.pod  view on Meta::CPAN



=head3 _meta completion generate

    apicli _meta completion generate [options]

Generate self completion

Options:

    --name    name of the program (optional, override name in spec)
    --zsh     for zsh (flag)                                       
    --bash    for bash (flag)                                      


=head3 _meta pod

    apicli _meta pod <subcommands>

Pod documentation

share/completion/bash/apicli.bash  view on Meta::CPAN

            2)
                __comp_current_options || return
                __apicli_dynamic_comp 'commands' 'generate'$'\t''Generate self completion'

            ;;
            *)
            # subcmds
            case ${MYWORDS[2]} in
              generate)
                FLAGS+=('--zsh' 'for zsh' '--bash' 'for bash')
                OPTIONS+=('--name' 'name of the program (optional, override name in spec)')
                __apicli_handle_options_flags
                  case $INDEX in
                  *)
                    __comp_current_options true || return # after parameters
                    case ${MYWORDS[$INDEX-1]} in
                      --name)
                      ;;

                    esac
                    ;;

share/completion/zsh/_apicli  view on Meta::CPAN

                            case $line[3] in
                            generate)

                                # ---- Command: _meta completion generate
                                _arguments -s -C \
                                    '1: :->cmd1' \
                                    '2: :->cmd2' \
                                    '3: :->cmd3' \
                                    '--help[Show command help]' \
                                    '-h[Show command help]' \
                                    '--name[name of the program (optional, override name in spec)]:name' \
                                    '--zsh[for zsh]' \
                                    '--bash[for bash]' \
                                    && ret=0


                            ;;
                            esac

                        ;;

t/00.compile.t  view on Meta::CPAN

use File::Spec;
use IPC::Open3;
use IO::Handle;

open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";

my @warnings;
for my $lib (@module_files)
{
    # see L<perlfaq8/How can I capture STDERR from an external command?>
    my $stderr = IO::Handle->new;

    diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
            $^X, @switches, '-e', "require q[$lib]"))
        if $ENV{PERL_COMPILE_TEST_DEBUG};

    my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]");
    binmode $stderr, ':crlf' if $^O eq 'MSWin32';
    my @_warnings = <$stderr>;
    waitpid($pid, 0);
    is($?, 0, "$lib loaded ok");

    shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
        and not eval { require blib; blib->VERSION('1.01') };

    if (@_warnings)
    {
        warn @_warnings;
        push @warnings, @_warnings;

t/00.compile.t  view on Meta::CPAN

}

foreach my $file (@scripts)
{ SKIP: {
    open my $fh, '<', $file or warn("Unable to open $file: $!"), next;
    my $line = <$fh>;

    close $fh and skip("$file isn't perl", 1) unless $line =~ /^#!\s*(?:\S*perl\S*)((?:\s+-\w*)*)(?:\s*#.*)?$/;
    @switches = (@switches, split(' ', $1)) if $1;

    my $stderr = IO::Handle->new;

    diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
            $^X, @switches, '-c', $file))
        if $ENV{PERL_COMPILE_TEST_DEBUG};

    my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-c', $file);
    binmode $stderr, ':crlf' if $^O eq 'MSWin32';
    my @_warnings = <$stderr>;
    waitpid($pid, 0);
    is($?, 0, "$file compiled ok");

    shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
        and not eval { require blib; blib->VERSION('1.01') };

    # in older perls, -c output is simply the file portion of the path being tested
    if (@_warnings = grep { !/\bsyntax OK$/ }
        grep { chomp; $_ ne (File::Spec->splitpath($file))[2] } @_warnings)
    {



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