The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::GitHubUtils - Utilities related to GitHub

VERSION

This document describes version 0.009 of App::GitHubUtils (from Perl distribution App-GitHubUtils), released on 2021-08-14.

DESCRIPTION

This distribution provides the following command-line utilities related to GitHub:

FUNCTIONS

create_this_repo_on_github

Usage:

 create_this_repo_on_github(%args) -> [$status_code, $reason, $payload, \%result_meta]

Create this repo on github.

This is a convenient no-argument-needed command to create GitHub repository of the current ("this") repo. Will use github-cmd from App::github::cmd to create the repository. To find out the repo name to be created, will first check .git/config if it exists. Otherwise, will just use the name of the current directory.

This function is not exported.

Arguments ('*' denotes required arguments):

  • github_cmd_config_profile => str

Returns an enveloped result (an array).

First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.

Return value: (any)

git_clone_from_github

Usage:

 git_clone_from_github(%args) -> [$status_code, $reason, $payload, \%result_meta]

git clone, with some conveniences.

Instead of having to type:

 % git clone git@github.com:USER/PREFIX-NAME.git

you can just type:

 % git-clone-from-github NAME

The utility will try the users specified in config file, as well as prefixes and clone the first repo that exists. You can put something like this in githubutils.conf:

 [prog=git-clone-from-github]
 users = ["perlancar", "perlancar2"]
 prefixes = ["perl5-", "perl-"]
 suffixes = ["-p5"]

The utility will check whether repo in these URLs exist:

 git@github.com:perlancar/perl5-NAME.git
 git@github.com:perlancar/perl-NAME.git
 git@github.com:perlancar/NAME-p5.git
 git@github.com:perlancar2/perl5-NAME.git
 git@github.com:perlancar2/perl-NAME.git
 git@github.com:perlancar2/NAME-p5.git

This function is not exported.

Arguments ('*' denotes required arguments):

  • name* => str

  • prefixes => array[str]

  • suffixes => array[str]

  • users => array[str]

    If not specified, will use login from github-cmd.conf file.

Returns an enveloped result (an array).

First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.

Return value: (any)

this_repo_on_github

Usage:

 this_repo_on_github() -> [$status_code, $reason, $payload, \%result_meta]

This function is not exported.

No arguments.

Returns an enveloped result (an array).

First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.

Return value: (any)

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/App-GitHubUtils.

SOURCE

Source repository is at https://github.com/perlancar/perl-App-GitHubUtils.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-GitHubUtils

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

github-cmd from App::github::cmd

Net::GitHub

Pithub

App::GitUtils

AUTHOR

perlancar <perlancar@cpan.org>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

 % prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2021, 2020, 2019, 2018 by perlancar <perlancar@cpan.org>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.