GithubHelp home page GithubHelp logo

app-gh's Introduction

App::gh

App::gh is an utility helps you operate commands through GitHub's API, currently App::gh is migrating to GitHub API v3.

Installation

App::gh is written in Perl, so you might need a cpanminus to install CPAN modules, to install cpanminus:

    $ curl -L http://cpanmin.us | perl - --sudo App::cpanminus

Now you have cpanm, you can install App::gh

    $ sudo cpanm https://github.com/c9s/App-gh/zipball/develop

Setup

To use App::gh, you need to configure your password or OAuth token in your .gitconfig file, just drop the lines below to setup your password:

    [github]
        user = c9s
        password = your password

To use OAuth token, you need to set your OAuth access token:

    [github]
        user = c9s
        access_token = SHA1601f1889667efaebb33b8c12572835da3f027f78

Commands

clone

To clone a repository, use below command form:

    $ gh clone [user]/[repo]
    $ gh clone [user] [repo]

When cloning repository from others, the default URI is HTTP, which is read-only.

When cloning repository from yourself, the default URI is SSH, which is read & write.

To specify URI type, you can simply pass options like --http for HTTP, --https for HTTPS, --ssh for SSH, --ro for read-only URI. e.g.:

    $ gh clone miyagawa Plack

    $ gh clone user repo --http

    $ gh clone user repo --https

    $ gh clone user repo --ssh

    $ gh clone clkao Web-Hippie --ro

Clone from SSH URI:

    $ gh clone miyagawa/Plack --ssh

To fetch related remote of forks, you can specify --forks option. this command allows you to download commits from others' fork.

    $ gh clone c9s App-gh --forks

To clone repository and set the default remote name instead of origin, you can specify --origin option:

    $ gh clone c9s App-gh --origin github

all

By using the all command, you can clone all repositories from an user.

Below is the basic form:

    $ gh all [user] [type]

The [type] can be member, all, owner. if you specify all then all repositories including fork projects will be cloned. if you specify owner, then only the owner's projects will be cloned.

For example, to clone all repositories of miyagawa:

    $ gh all miyagawa

To clone all repositories that owned by facebook:

    $ gh all facebook owner

By specifing --into option, you can clone these repositories into a specific directory, for example:

    $ gh all facebook owner --into path/to/facebook

    $ gh all perl6 --into perl6-stuff

To prompt before cloning each repository:

    $ gh all perl6 --prompt

To also fetch tags, you can specify --tags option:

    $ gh all facebook --tags

You can also specify a prefix to each repo:

    $ gh all facebook --prefix=facebook-prefix-

To clone these repositories as bared:

    $ gh all facebook --bare

To recursively clone submodules:

    $ gh all perl6 --recursive

import

By using the import command, you can import your git repository to your GitHub account.

You can simply type below line the upload your project:

    $ gh import

To specify remote name for GitHub, you can use --remote option.

    $ gh import --remote github

search

To search repositories, simply use search command:

    $ gh search keyword

update

Sometimes you need to update remote refs, branches, tags, you might run git remote update --prune, and run pull with --rebase option to rebase changes on your local branch.

With App::gh, you can do simpler with the update command.

    $ gh update

The command above actually runs:

    git remote update --prune
    git remote | while read remote; do
        git pull --rebase $remote $(git rev-parse --abbrev-ref HEAD)
    done

INSTALLATION

To install this module, run the following commands:

# Makefile.PL needs this
cpan Module::Install::AuthorTests

perl Makefile.PL
make
make test
make install

COMPLETION

zsh

$ mkdir ~/.zsh/functions
$ cp completion/zsh/_gh  ~/.zsh/functions

add ~/.zsh/functions to your fpath

$ vim ~/.zshrc

fpath=(~/.zsh/functions/ $fpath)

DEVELOPMENT

please keep the dependency simple and less.

CONTRIBUTORS

Alexandr Ciornii [email protected]
Breno G. de Oliveira [email protected]
Chris Weyl [email protected]
Fuji, Goro [email protected]
Ryan C. Thompson [email protected]
Tokuhiro Matsuno [email protected]
Yo-An Lin [email protected]
Zak B. Elep [email protected]
c9s [email protected]
chocolateboy [email protected]
mattn [email protected]
tokuhirom [email protected]
tyru [email protected]
xaicron [email protected]
yj [email protected]

SUPPORT AND DOCUMENTATION

After installing, you can find documentation for this module with the perldoc command.

perldoc App::gh

You can also look for information at:

RT, CPAN's request tracker
    http://rt.cpan.org/NoAuth/Bugs.html?Dist=App-gh

AnnoCPAN, Annotated CPAN documentation
    http://annocpan.org/dist/App-gh

CPAN Ratings
    http://cpanratings.perl.org/d/App-gh

Search CPAN
    http://search.cpan.org/dist/App-gh/

LICENSE AND COPYRIGHT

Copyright (C) 2010 Cornelius

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

app-gh's People

Contributors

briandfoy avatar c9s avatar chocolateboy avatar chorny avatar darwinawardwinner avatar dsteinbrunner avatar garu avatar gfx avatar liyuray avatar mattn avatar rsrchboy avatar tokuhirom avatar tyru avatar xaicron avatar yanick avatar zakame avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

app-gh's Issues

gh pull displays error about uninitialized values

nadim@naquadim Prima (master)$ gh pull
Usage:
gh pull [userid](from branch) (to branch)

Available forks:
Use of uninitialized value $userid in concatenation (.) or string at /usr/lib64/perl5/site_perl/5.12.3/App/gh/Command/Pull.pm line 82.
Use of uninitialized value $repo in concatenation (.) or string at /usr/lib64/perl5/site_perl/5.12.3/App/gh/Command/Pull.pm line 82.
401 Unauthorized: {"error":"api route not recognized"} at /usr/lib64/perl5/site_perl/5.12.3/App/gh/API.pm line 30.

Add Public Key Maker

I would like this even more is there was a command for automatically building ssh public key, also see App-Rad for a better CLI (I helped on this project) :)

New CPAN release

There has been no release since 2013, and there are a few patches waiting in master.

Btw, if you want to throw co-maint at me, I can take care of that. :-)

Ability to run gh all username

Ability to run gh all username and have it update or pull, if you run it once it works fine, but if you run it and the repos already exist it blows up.

gh --help doesn't works

gh --help says

Command not recognized, try /Users/tokuhirom/perl5/perlbrew/bin/gh --help.
It's so inifinate loop.

Ability to create repository

It would be cool if I could do
gh create RepoName --init --add-all

creates repo on github

git init
adds remotes
adds all files
prompts for commit message.

Doesn't do Paging

No paging, for people with lots of repos spanning multiple pages (as per the API docs)

IO/Pager missing from Makefile

Failed test 'use App::gh::Command::Recent;'

at t/00-load.t line 19.

Tried to use 'App::gh::Command::Recent'.

Error: Can't locate IO/Pager.pm in @inc (@inc contains: lib C:\strawberry\cpan\build\App-gh-0.254-GIa8As\inc C:\strawberry\cpan\

build\App-gh-0.254-GIa8As\blib\lib C:\strawberry\cpan\build\App-gh-0.254-GIa8As\blib\arch C:/Strawberry/perl/lib C:/Strawberry/perl/sit
e/lib C:\strawberry\perl\vendor\lib .) at lib/App/gh/Command/Recent.pm line 9.

BEGIN failed--compilation aborted at lib/App/gh/Command/Recent.pm line 9.

Compilation failed in require at (eval 31) line 2.

BEGIN failed--compilation aborted at (eval 31) line 2.

Failed test 'use App::gh::Command::Cloneall;'

at t/00-load.t line 20.

Tried to use 'App::gh::Command::Cloneall'.

Error: Can't locate App/gh/Command/Cloneall.pm in @inc (@inc contains: lib C:\strawberry\cpan\build\App-gh-0.254-GIa8As\inc C:\s

trawberry\cpan\build\App-gh-0.254-GIa8As\blib\lib C:\strawberry\cpan\build\App-gh-0.254-GIa8As\blib\arch C:/Strawberry/perl/lib C:/Stra
wberry/perl/site/lib C:\strawberry\perl\vendor\lib .) at (eval 32) line 2.

BEGIN failed--compilation aborted at (eval 32) line 2.

Looks like you failed 2 tests of 10.

t/00-load.t ... Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/10 subtests
t/manifest.t .. skipped: Author tests not required for installation
t/pod.t ....... ok

tempfile error

After updating File::Temp to version 0.23, some git commands dies:

git svn fetch
Authentication realm: ...
'tempfile' can't be called as a method at /usr/lib/perl5/vendor_perl/5.16.2/Git.pm line 1094.

The following change appears to solve the problem.

diff Git.pm.orig Git.pm
1094c1094

< ($$temp_fd, $fname) = File::Temp->tempfile(

          ($$temp_fd, $fname) = File::Temp::tempfile(

Also App::gh::Command::Cloneall error

t/00-load.t ... 4/10

Failed test 'use App::gh::Command::Cloneall;'

at t/00-load.t line 20.

Tried to use 'App::gh::Command::Cloneall'.

Error: Can't locate App/gh/Command/Cloneall.pm in @inc (@inc contains: lib C:\strawberry\cpan\build\App-gh-0.254-Mk57Ei\inc C:\s

trawberry\cpan\build\App-gh-0.254-Mk57Ei\blib\lib C:\strawberry\cpan\build\App-gh-0.254-Mk57Ei\blib\arch C:/Strawberry/perl/lib C:/Stra
wberry/perl/site/lib C:\strawberry\perl\vendor\lib .) at (eval 34) line 2.

BEGIN failed--compilation aborted at (eval 34) line 2.

Looks like you failed 1 test of 10.

t/00-load.t ... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/10 subtests
t/manifest.t .. skipped: Author tests not required for installation
t/pod.t ....... ok

Provide some basic help on usage

There seems to be absolutely no online help on how to use gh. The output from gh --help is particularly ironic. Please provide some basic usage or at least a pointer to where documentation can be found.

$ type gh
gh is hashed (/usr/local/bin/gh)

$ perldoc gh
No documentation found for "gh".

$ man gh
No manual entry for gh

$ gh --help
Command '--help' not recognized, try /usr/local/bin/gh --help.

$ gh -h
Command '-h' not recognized, try /usr/local/bin/gh --help.

$ gh -?
Command '-?' not recognized, try /usr/local/bin/gh --help.

gh info/gh import broken in gh 0.46

App::gh::API->request() calls for operations needing authentication is broken, leading to gh info' orgh import' exiting with `401 Unauthorized' upon invocation. Inspection of the resulting HTTP request shows that login and token credentials are passed as HTTP headers, when they ought to be either query parameters (for GET requests) or inside a multipart/form-data (for POST requests.)

I'm working on a fix on my fork, I'll send a pull request shortly.

Use Git.pm instead of qx for executing git commands.

It's safer to use Git.pm's command functionality than to use qx to execute git commands from Perl. I've already converted Import.pm in my import-improvements branch, and you can use this as an example to fix the others.

In order to use this, you have to create a repository object using Git->repository(), which defaults to the current directory. Perhaps you should add a wrapper for this in App:gh::Utils so you don't have to use Git; in every command.

Support local github token setting

App::gh now works only with global github token setting.

$ git clone <repo>
$ cd <repo>
$ git config github.user <user>
$ git config github.token <token>
$ gh recent
Use of uninitialized value $user in concatenation (.) or string at /usr/local/share/perl/5.12.4/App/gh/Command/Recent.pm line 31.
Use of uninitialized value $token in concatenation (.) or string at /usr/local/share/perl/5.12.4/App/gh/Command/Recent.pm line 31.
Died at /usr/local/share/perl/5.12.4/App/gh/Command/Recent.pm line 32.

I wonder if gh command could read local setting if it (<repo>/.gitconfig) exists.

Prevent for "API Rate Limit Exceeded"

403 Forbidden: {"error":["API Rate Limit Exceeded for xxxxxxxx"]} at /Users/c9s/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/App/gh/API.pm line 43.

Clone error

Undefined subroutine &App::gh::Command::Clone::build_git_clone_options called at /opt/local/lib/perl5/site_perl/5.12.4/App/gh/Command/Clone.pm line 77.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.