Giter Club home page Giter Club logo

donnemartin / gitsome Goto Github PK

View Code? Open in Web Editor NEW
7.5K 120.0 436.0 1.36 MB

A supercharged Git/GitHub command line interface (CLI). An official integration for GitHub and GitHub Enterprise: https://github.com/works-with/category/desktop-tools

License: Other

Python 94.40% Shell 0.05% Batchfile 0.01% Dockerfile 0.04% Makefile 0.01% HTML 5.39% Visual Basic 0.11% C 0.01%
github-enterprise git github cli command-line python github-api github-client development developer-tools

gitsome's Introduction

An Official Integration for GitHub and GitHub Enterprise.

gitsome

Build Status PyPI version PyPI License

Why gitsome?

The Git Command Line

Although the standard Git command line is a great tool to manage your Git-powered repos, it can be tough to remember the usage of:

  • 150+ porcelain and plumbing commands
  • Countless command-specific options
  • Resources such as tags and branches

The Git command line does not integrate with GitHub, forcing you to toggle between command line and browser.

gitsome - A Supercharged Git/GitHub CLI With Autocomplete

gitsome aims to supercharge your standard git/shell interface by focusing on:

  • Improving ease-of-use
  • Increasing productivity

Deep GitHub Integration

Not all GitHub workflows work well in a terminal; gitsome attempts to target those that do.

gitsome includes 29 GitHub integrated commands that work with ALL shells:

$ gh <command> [param] [options]

Run gh commands along with Git-Extras and hub commands to unlock even more GitHub integrations!

Imgur

Git and GitHub Autocompleter With Interactive Help

You can run the optional shell:

 $ gitsome

to enable autocompletion and interactive help for the following:

Imgur

Imgur

General Autocompleter

gitsome autocompletes the following:

  • Shell commands
  • Files and directories
  • Environment variables
  • Man pages
  • Python

To enable additional autocompletions, check out the Enabling Bash Completions section.

Imgur

Fish-Style Auto-Suggestions

gitsome supports Fish-style auto-suggestions. Use the right arrow key to complete a suggestion.

Imgur

Python REPL

gitsome is powered by xonsh, which supports a Python REPL.

Run Python commands alongside shell commands:

Imgur

Additional xonsh features can be found in the xonsh tutorial.

Command History

gitsome keeps track of commands you enter and stores them in ~/.xonsh_history.json. Use the up and down arrow keys to cycle through the command history.

Imgur

Customizable Highlighting

You can control the ansi colors used for highlighting by updating your ~/.gitsomeconfig file.

Color options include:

'black', 'red', 'green', 'yellow',
'blue', 'magenta', 'cyan', 'white'

For no color, set the value(s) to None. white can appear as light gray on some terminals.

Imgur

Available Platforms

gitsome is available for Mac, Linux, Unix, Windows, and Docker.

TODO

Not all GitHub workflows work well in a terminal; gitsome attempts to target those that do.

  • Add additional GitHub API integrations

gitsome is just getting started. Feel free to contribute!

Index

GitHub Integration Commands

Installation and Tests

Misc

GitHub Integration Commands Syntax

Usage:

$ gh <command> [param] [options]

GitHub Integration Commands Listing

  configure            Configure gitsome.
  create-comment       Create a comment on the given issue.
  create-issue         Create an issue.
  create-repo          Create a repo.
  emails               List all the user's registered emails.
  emojis               List all GitHub supported emojis.
  feed                 List all activity for the given user or repo.
  followers            List all followers and the total follower count.
  following            List all followed users and the total followed count.
  gitignore-template   Output the gitignore template for the given language.
  gitignore-templates  Output all supported gitignore templates.
  issue                Output detailed information about the given issue.
  issues               List all issues matching the filter.
  license              Output the license template for the given license.
  licenses             Output all supported license templates.
  me                   List information about the logged in user.
  notifications        List all notifications.
  octo                 Output an Easter egg or the given message from Octocat.
  pull-request         Output detailed information about the given pull request.
  pull-requests        List all pull requests.
  rate-limit           Output the rate limit.  Not available for Enterprise.
  repo                 Output detailed information about the given filter.
  repos                List all repos matching the given filter.
  search-issues        Search for all issues matching the given query.
  search-repos         Search for all repos matching the given query.
  starred              Output starred repos.
  trending             List trending repos for the given language.
  user                 List information about the given user.
  view                 View the given index in the terminal or a browser.

GitHub Integration Commands Reference: COMMANDS.md

See the GitHub Integration Commands Reference in COMMANDS.md for a detailed discussion of all GitHub integration commands, parameters, options, and examples.

Check out the next section for a quick reference.

GitHub Integration Commands Quick Reference

Configuring gitsome

To properly integrate with GitHub, you must first configure gitsome:

$ gh configure

For GitHub Enterprise users, run with the -e/--enterprise flag:

$ gh configure -e

Listing Feeds

Listing Your News Feed

$ gh feed

Imgur

Listing A User's Activity Feed

View your activity feed or another user's activity feed, optionally through a pager with -p/--pager. The pager option is available for many commands.

$ gh feed donnemartin -p

Imgur

Listing A Repo's Activity Feed

$ gh feed donnemartin/gitsome -p

Imgur

Listing Notifications

$ gh notifications

Imgur

Listing Pull Requests

View all pull requests for your repos:

$ gh pull-requests

Imgur

Filtering Issues

View all open issues where you have been mentioned:

$ gh issues --issue_state open --issue_filter mentioned

Imgur

View all issues, filtering for only those assigned to you, regardless of state (open, closed):

$ gh issues --issue_state all --issue_filter assigned

For more information about the filter and state qualifiers, visit the gh issues reference in COMMANDS.md.

Filtering Starred Repos

$ gh starred "repo filter"

Imgur

Searching Issues and Repos

Searching Issues

Search issues that have the most +1s:

$ gh search-issues "is:open is:issue sort:reactions-+1-desc" -p

Imgur

Search issues that have the most comments:

$ gh search-issues "is:open is:issue sort:comments-desc" -p

Search issues with the "help wanted" tag:

$ gh search-issues "is:open is:issue label:\"help wanted\"" -p

Search issues that have your user name tagged @donnemartin:

$ gh search-issues "is:issue donnemartin is:open" -p

Search all your open private issues:

$ gh search-issues "is:open is:issue is:private" -p

For more information about the query qualifiers, visit the searching issues reference.

Searching Repos

Search all Python repos created on or after 2015, with >= 1000 stars:

$ gh search-repos "created:>=2015-01-01 stars:>=1000 language:python" --sort stars -p

Imgur

For more information about the query qualifiers, visit the searching repos reference.

Listing Trending Repos and Devs

View trending repos:

$ gh trending [language] [-w/--weekly] [-m/--monthly] [-d/--devs] [-b/--browser]

Imgur

View trending devs (devs are currently only supported in browser):

$ gh trending [language] --devs --browser

Viewing Content

The view command

View the previously listed notifications, pull requests, issues, repos, users etc, with HTML nicely formatted for your terminal, or optionally in your browser:

$ gh view [#] [-b/--browser]

Imgur

The issue command

View an issue:

$ gh issue donnemartin/saws/1

Imgur

The pull-request command

View a pull request:

$ gh pull-request donnemartin/awesome-aws/2

Imgur

Setting Up .gitignore

List all available .gitignore templates:

$ gh gitignore-templates

Imgur

Set up your .gitignore:

$ gh gitignore-template Python > .gitignore

Imgur

Setting Up LICENSE

List all available LICENSE templates:

$ gh licenses

Imgur

Set up your or LICENSE:

$ gh license MIT > LICENSE

Imgur

Summoning Octocat

Call on Octocat to say the given message or an Easter egg:

$ gh octo [say]

Imgur

Viewing Profiles

Viewing A User's Profile

$ gh user octocat

Imgur

Viewing Your Profile

View your profile with the gh user [YOUR_USER_ID] command or with the following shortcut:

$ gh me

Imgur

Creating Comments, Issues, and Repos

Create a comment:

$ gh create-comment donnemartin/gitsome/1 -t "hello world"

Create an issue:

$ gh create-issue donnemartin/gitsome -t "title" -b "body"

Create a repo:

$ gh create-repo gitsome

Option: View in a Pager

Many gh commands support a -p/--pager option that displays results in a pager, where available.

Usage:

$ gh <command> [param] [options] -p
$ gh <command> [param] [options] --pager

Option: View in a Browser

Many gh commands support a -b/--browser option that displays results in your default browser instead of your terminal.

Usage:

$ gh <command> [param] [options] -b
$ gh <command> [param] [options] --browser

See the COMMANDS.md for a detailed listing of all GitHub integration commands, parameters, options, and examples.

Having trouble remembering these commands? Check out the handy autocompleter with interactive help to guide you through each command.

Note, you can combine gitsome with other utilities such as Git-Extras.

Installation

Pip Installation

PyPI version PyPI

gitsome is hosted on PyPI. The following command will install gitsome:

$ pip3 install gitsome

You can also install the latest gitsome from GitHub source which can contain changes not yet pushed to PyPI:

$ pip3 install git+https://github.com/donnemartin/gitsome.git

If you are not installing in a virtualenv, you might need to run with sudo:

$ sudo pip3 install gitsome

pip3

Depending on your setup, you might also want to run pip3 with the -H flag:

$ sudo -H pip3 install gitsome

For most linux users, pip3 can be installed on your system using the python3-pip package.

For example, Ubuntu users can run:

$ sudo apt-get install python3-pip

See this ticket for more details.

Virtual Environment Installation

You can install Python packages in a virtualenv to avoid potential issues with dependencies or permissions.

If you are a Windows user or if you would like more details on virtualenv, check out this guide.

Install virtualenv and virtualenvwrapper:

$ pip3 install virtualenv
$ pip3 install virtualenvwrapper
$ export WORKON_HOME=~/.virtualenvs
$ source /usr/local/bin/virtualenvwrapper.sh

Create a gitsome virtualenv and install gitsome:

$ mkvirtualenv gitsome
$ pip3 install gitsome

If the pip install does not work, you might be running Python 2 by default. Check what version of Python you are running:

$ python --version

If the call above results in Python 2, find the path for Python 3:

$ which python3  # Python 3 path for mkvirtualenv's --python option

Install Python 3 if needed. Set the Python version when calling mkvirtualenv:

$ mkvirtualenv --python [Python 3 path from above] gitsome
$ pip3 install gitsome

If you want to activate the gitsome virtualenv again later, run:

$ workon gitsome

To deactivate the gitsome virtualenv, run:

$ deactivate

Running as a Docker Container

You can run gitsome in a Docker container to avoid installing Python and pip3 locally. To install Docker check out the official Docker documentation.

Once you have docker installed you can run gitsome:

$ docker run -ti --rm mariolet/gitsome

You can use Docker volumes to let gitsome access your working directory, your local .gitsomeconfig and .gitconfig:

$ docker run -ti --rm -v $(pwd):/src/              \
   -v ${HOME}/.gitsomeconfig:/root/.gitsomeconfig  \
   -v ${HOME}/.gitconfig:/root/.gitconfig          \
   mariolet/gitsome

If you are running this command often you will probably want to define an alias:

$ alias gitsome="docker run -ti --rm -v $(pwd):/src/              \
                  -v ${HOME}/.gitsomeconfig:/root/.gitsomeconfig  \
                  -v ${HOME}/.gitconfig:/root/.gitconfig          \
                  mariolet/gitsome"

To build the Docker image from sources:

$ git clone https://github.com/donnemartin/gitsome.git
$ cd gitsome
$ docker build -t gitsome .

Starting the gitsome Shell

Once installed, run the optional gitsome autocompleter with interactive help:

$ gitsome

Running the optional gitsome shell will provide you with autocompletion, interactive help, fish-style suggestions, a Python REPL, etc.

Running gh Commands

Run GitHub-integrated commands:

$ gh <command> [param] [options]

Note: Running the gitsome shell is not required to execute gh commands. After installing gitsome you can run gh commands from any shell.

Running the gh configure Command

To properly integrate with GitHub, gitsome must be properly configured:

$ gh configure

For GitHub Enterprise Users

Run with the -e/--enterprise flag:

$ gh configure -e

View more details in the gh configure section.

Enabling Bash Completions

By default, gitsome looks at the following locations to enable bash completions.

To add additional bash completions, update the ~/.xonshrc file with the location of your bash completions.

If ~/.xonshrc does not exist, create it:

$ touch ~/.xonshrc

For example, if additional completions are found in /usr/local/etc/my_bash_completion.d/completion.bash, add the following line in ~/.xonshrc:

$BASH_COMPLETIONS.append('/usr/local/etc/my_bash_completion.d/completion.bash')

You will need to restart gitsome for the changes to take effect.

Enabling gh Tab Completions Outside of gitsome

You can run gh commands outside of the gitsome shell completer. To enable gh tab completions for this workflow, copy the gh_complete.sh file locally.

Let bash know completion is available for the gh command within your current session:

$ source /path/to/gh_complete.sh

To enable tab completion for all terminal sessions, add the following to your bashrc file:

source /path/to/gh_complete.sh

Reload your bashrc:

$ source ~/.bashrc

Tip: . is the short form of source, so you can run this instead:

$ . ~/.bashrc

For Zsh Users

zsh includes a module which is compatible with bash completions.

Download the gh_complete.sh file as above and append the following to your .zshrc:

autoload bashcompinit
bashcompinit
source /path/to/gh_complete.sh

Reload your zshrc:

 $ source ~/.zshrc

Optional: Installing PIL or Pillow

Displaying the avatar for the gh me and gh user commands will require installing the optional PIL or Pillow dependency.

Windows* and Mac:

$ pip3 install Pillow

*See the Windows Support section for limitations on the avatar.

Ubuntu users, check out these instructions on askubuntu

Supported Python Versions

  • Python 3.4
  • Python 3.5
  • Python 3.6
  • Python 3.7

gitsome is powered by xonsh which does not currently support Python 2.x, as discussed in this ticket.

Supported Platforms

  • Mac OS X
    • Tested on OS X 10.10
  • Linux, Unix
    • Tested on Ubuntu 14.04 LTS
  • Windows
    • Tested on Windows 10

Windows Support

gitsome has been tested on Windows 10 with cmd and cmder.

Although you can use the standard Windows command prompt, you'll probably have a better experience with either cmder or conemu.

Imgur

Text Only Avatar

The commands gh user and gh me will always have the -t/--text_avatar flag enabled, since img2txt does not support the ansi avatar on Windows.

Config File

On Windows, the .gitsomeconfig file can be found in %userprofile%. For example:

C:\Users\dmartin\.gitsomeconfig

Developer Installation

If you're interested in contributing to gitsome, run the following commands:

$ git clone https://github.com/donnemartin/gitsome.git
$ cd gitsome
$ pip3 install -e .
$ pip3 install -r requirements-dev.txt
$ gitsome
$ gh <command> [param] [options]

pip3

If you get an error while installing saying that you need Python 3.4+, it could be because your pip command is configured for an older version of Python. To fix this issue, it is recommended to install pip3:

$ sudo apt-get install python3-pip

See this ticket for more details.

Continuous Integration

Build Status

Continuous integration details are available on Travis CI.

Unit Tests and Code Coverage

Run unit tests in your active Python environment:

$ python tests/run_tests.py

Run unit tests with tox on multiple Python environments:

$ tox

Documentation

Source code documentation will soon be available on Readthedocs.org. Check out the source docstrings.

Run the following to build the docs:

$ scripts/update_docs.sh

Contributing

Contributions are welcome!

Review the Contributing Guidelines for details on how to:

  • Submit issues
  • Submit pull requests

Credits

Contact Info

Feel free to contact me to discuss any issues, questions, or comments.

My contact info can be found on my GitHub page.

License

I am providing code and resources in this repository to you under an open source license. Because this is my personal repository, the license you receive to my code and resources is from me and not my employer (Facebook).

License

Copyright 2016 Donne Martin

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

gitsome's People

Contributors

andriisoldatenko avatar blrsn avatar carreau avatar cclauss avatar cyblue9 avatar dbaio avatar dongweiming avatar donnemartin avatar emres avatar fmarco avatar frdmn avatar jashgala avatar joy2fun avatar kamontat avatar karunamon avatar kbite avatar l0rd avatar ltworf avatar manu343726 avatar muescha avatar notatestuser avatar nttibbetts avatar pravj avatar radarhere avatar readmecritic avatar sanketdg avatar zyeoman 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  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  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  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

gitsome's Issues

Command create-repo results in NoneType conversion if no description is specified

Similar to #40, but with create-repo command.

Full backtrace bellow:

Traceback (most recent call last):
  File "/usr/bin/gh", line 9, in <module>
    load_entry_point('gitsome==0.5.0', 'console_scripts', 'gh')()
  File "/usr/lib/python3.5/site-packages/gitsome/main_cli.py", line 26, in cli
    github.cli()
  File "/usr/lib/python3.5/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.5/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.5/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.5/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.5/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.5/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/usr/lib/python3.5/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.5/site-packages/gitsome/githubcli.py", line 147, in create_repo
    github.create_repo(repo_name, repo_desc, private)
  File "/usr/lib/python3.5/site-packages/gitsome/github.py", line 84, in auth_wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3.5/site-packages/gitsome/github.py", line 232, in create_repo
    repo.description),
TypeError: Can't convert 'NoneType' object to str implicitly

iTerm2 + ohmyzsh

I am using iTerm2 + ohmyzsh on OSX 10.11.4, and I do get the following message after running gitsome => zsh: command not found: gitsome

Install error

I get an error..

Command "python setup.py egg_info" failed with error code 1 in /var/folders/74/sgsf27_x7v72qt6pv18j52sm0000gn/T/pip-CwasZv-build/

Linux dotfiles, XDG Base Directory

It would be a good practice if you put all dot files from gitsome in appropriate directory based on the XDG Base Directory specification. Same goes for other operating systems, but unfortunately I'm not familiar what exactly is the best practice there.

As for Linux:

  • configuration files go to $XDG_CONFIG_HOME, which defaults ~/.config/ directory
  • cache files go to $XDG_CACHE_HOME, which defaults ~/.cache/ directory
  • any other files go to $XDG_DATA_HOME, which defaults to ~/.local/share/ directory

Add hub autocompletions and interactive help

These GitHub commands are provided by hub:

   pull-request   Open a pull request on GitHub
   fork           Make a fork of a remote repository on GitHub and add as remote
   create         Create this repository on GitHub and add GitHub as origin
   browse         Open a GitHub page in the default browser
   compare        Open a compare page on GitHub
   release        List or create releases (beta)
   issue          List or create issues (beta)
   ci-status      Show the CI status of a commit

Can not access to a private repo with a personal access tokens

Hello,

I've configured an access token (in User Token with gh configure) but I cannot access to a private repo owned by an organisation in which I am.

I have this error:

Viewing https://github.com/orga/privateRepo/

{"error":"Not Found"}

View this article in a browser with the -b/--browser flag.

Press q to quit viewing this article.

Refactor conversion code of None to '' introduced in #40 and #49

The fixes for the following issues were very similar and would probably be better suited as a string utility in TextUtils.

  • #40 - Fix create-issue NoneType error if no -b/--body is specified.
  • #49 - Fix create-repo NoneType error if no -d/--description is specified.

TODO:

  • Add equivalent utility function and unit test(s).
  • Update code from #40
    and #49.

See #50 for initial discussion.

Windows: git doesn't use .gitconfig in home directory

On Windows 7, in my home directory I have a .gitconfig with:

[alias]
        lg = log --graph --pretty=...

Inside the gitsome shell:

$ git lg
git: 'lg' is not a git command. See 'git --help'.

Did you mean this?
log

and

$ git config --global -l
fatal: unable to read config file 'C://.gitconfig': No such file or directory

So git (inside gitsome) is looking for the config file in c:/ instead of my home directory.

UnicodeDecodeError: 'gbk' in windows 10

C:\Users\xxxx>gitsome
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Program Files\Python35\lib\threading.py", line 914, in _bootstrap_inner
self.run()
File "C:\Program Files\Python35\lib\threading.py", line 862, in run
self._target(_self._args, *_self._kwargs)
File "C:\Program Files\Python35\lib\subprocess.py", line 1283, in _readerthread
buffer.append(fh.read())
UnicodeDecodeError: 'gbk' codec can't decode byte 0x8b in position 3: illegal multibyte sequence

Traceback (most recent call last):
File "C:\Program Files\Python35\lib\runpy.py", line 184, in _run_module_as_main
"main", mod_spec)
File "C:\Program Files\Python35\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python35\lib\site-packages\xonsh\main.py", line 112, in
main()
File "C:\Program Files\Python35\lib\site-packages\xonsh\main.py", line 76, in main
shell = builtins.xonsh_shell = Shell(**shell_kwargs)
File "C:\Program Files\Python35\lib\site-packages\xonsh\shell.py", line 27, in init
self._init_environ(ctx)
File "C:\Program Files\Python35\lib\site-packages\xonsh\shell.py", line 57, in _init_environ
self.execer = Execer()
File "C:\Program Files\Python35\lib\site-packages\xonsh\execer.py", line 40, in init
load_builtins(execer=self)
File "C:\Program Files\Python35\lib\site-packages\xonsh\built_ins.py", line 648, in load_builtins
builtins.xonsh_env = ENV = Env(default_env())
File "C:\Program Files\Python35\lib\site-packages\xonsh\environ.py", line 676, in default_env
issue_warning=False))
File "C:\Program Files\Python35\lib\site-packages\xonsh\foreign_shells.py", line 205, in load_foreign_envs
shenv, _ = foreign_shell_data(**shell)
File "C:\Program Files\Python35\lib\site-packages\xonsh\foreign_shells.py", line 71, in foreign_shell_data
universal_newlines=True)
File "C:\Program Files\Python35\lib\subprocess.py", line 626, in check_output
**kwargs).stdout
File "C:\Program Files\Python35\lib\subprocess.py", line 695, in run
stdout, stderr = process.communicate(input, timeout=timeout)
File "C:\Program Files\Python35\lib\subprocess.py", line 1072, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "C:\Program Files\Python35\lib\subprocess.py", line 1333, in _communicate
stdout = stdout[0]
IndexError: list index out of range

gbk3

#I am Chinese user

Document necessary oauth scopes

It's awesome that I can choose to authenticate with a personal access token, but it would be even awesomer if you provided a guide for which scopes the application needs :)

Error when installing gitsome via pip3

Hello. I'm trying to install it in my Ubuntu 16.04 and it retrieve the code bellow..
I follow the instructions mentioned in #4

(~) ➜ () ➜ sudo -H pip3 install gitsome

Collecting gitsome
Using cached gitsome-0.6.0.tar.gz
Collecting numpydoc<1.0,>=0.5 (from gitsome)
Using cached numpydoc-0.6.0.tar.gz
Collecting ply<4.0,>=3.4 (from gitsome)
Using cached ply-3.8.tar.gz
Collecting prompt-toolkit<1.1.0,>=1.0.0 (from gitsome)
Using cached prompt_toolkit-1.0.0-py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): requests<3.0.0,>=2.8.1 in /usr/lib/python3/dist-packages (from gitsome)
Collecting colorama<1.0.0,>=0.3.3 (from gitsome)
Using cached colorama-0.3.7-py2.py3-none-any.whl
Collecting click<7.0,>=5.1 (from gitsome)
Using cached click-6.6.tar.gz
Collecting pygments<3.0.0,>=2.0.2 (from gitsome)
Using cached Pygments-2.1.3-py2.py3-none-any.whl
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 1006, in check_if_exists
self.satisfied_by = pkg_resources.get_distribution(str(no_marker))
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/init.py", line 535, in get_distribution
dist = get_provider(dist)
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/init.py", line 415, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/init.py", line 695, in find
raise VersionConflict(dist, req)
pkg_resources.VersionConflict: (feedparser 5.1.3 (/usr/lib/python3/dist-packages), Requirement.parse('feedparser<6.0.0,>=5.2.1'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 328, in run
wb.build(autobuilding=True)
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 748, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 448, in _prepare_file
req_to_install, finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 387, in _check_skip_installed
req_to_install.check_if_exists()
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 1011, in check_if_exists
self.req.project_name
AttributeError: 'Requirement' object has no attribute 'project_name'
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-7SrToZ/gitsome/

Update by donnemartin on 2019-04-07:

gitsome now supports Python 3.7, see #160.

PyPI: https://pypi.org/project/gitsome/


I get this error when I run:

sudo -H pip install gitsome
Collecting gitsome
  Downloading gitsome-0.4.0.tar.gz (278kB)
    100% |████████████████████████████████| 286kB 2.8MB/s 
    Complete output from command python setup.py egg_info:
    gitsome currently requires Python 3.4+

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-7SrToZ/gitsome/

What am I doing wrong?
I am on ubuntu 16.04

ZSH OSX - bashcompinit:134: parse error near `|'

bashcompinit:134: parse error near `|'
gh_complete.sh:8: command not found: complete

on iterm - oh my zsh - osx

.zshrc

autoload bashcompinit
bashcompinit
source gh_complete.sh

I also tried ~/gh-complete.sh

Provide single lined listings

At the moment, when I type git issues, two lines are used for each issue. For users/repos with many issues that uses a lot of extra space. Please provide a view that only takes one line per item.

customize prompt

what would be the best way to customize the prompt, including changing the color scheme?

Provide man pages

At the moment help can be got through --help. This is fine but not quite as intuitive as it could be: it is customary, that help can also be invoked though gh help|--help|-h <command>, gh <command> --help|-h and man gh <command>.
Usually also man pages are used as default, so that using the help commands or switches would merely open the man page.

'str' does not support the buffer interface on `gh feed`

I get following error:

$ gh feed
Listing events...
Traceback (most recent call last):
  File "/usr/bin/gh", line 9, in <module>
    load_entry_point('gitsome==0.6.0', 'console_scripts', 'gh')()
  File "/usr/lib/python3.4/site-packages/gitsome/main_cli.py", line 26, in cli
    github.cli()
  File "/usr/lib/python3.4/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.4/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.4/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.4/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.4/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.4/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/usr/lib/python3.4/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.4/site-packages/gitsome/githubcli.py", line 226, in feed
    github.feed(user_or_repo, private, pager)
  File "/usr/lib/python3.4/site-packages/gitsome/github.py", line 86, in auth_wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3.4/site-packages/gitsome/github.py", line 305, in feed
    items = self.trend_parser.parse(self.config.user_feed)
  File "/usr/lib/python3.4/site-packages/feedparser.py", line 3957, in parse
    saxparser.parse(source)
  File "/usr/lib64/python3.4/site-packages/drv_libxml2.py", line 189, in parse
    eltName = (_d(reader.NamespaceUri()),\
  File "/usr/lib64/python3.4/site-packages/drv_libxml2.py", line 70, in _d
    return _decoder(s)[0]
  File "/usr/lib64/python3.4/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
TypeError: 'str' does not support the buffer interface

version: gitsome-0.6.0 installed using pip3

system config:

$ uname -a
Linux foo 4.7.6-100.fc23.x86_64 #1 SMP Mon Oct 3 18:15:29 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Simultaneous GH and GHE support

It looks like gitsome supports either GitHub or GitHub Enterprise but not both simultaneously. Am I missing something or should this be a feature request? I work with repos in both and currently have to run gh configure each time I'm switching from GH to GHE or vice versa. It would be nice if for commands using my GHE profile I could use a switch like -e otherwise it defaults to GH.

Windows 7 - error on start

I installed gitsome with:

pip3 install gitsome

and it completed successfully.

When I then when to start gitsome in my ConEmu terminal, I got this result:

C:\Python27\python.exe: No module named xonsh

Not sure why it is trying to use Python27, though, as I installed it using Python 3.

Thanks!

Git autocomplete stopped working

I am not sure what I did, but I guess the git autocompletion broke for me...
I think it happened while I was trying to set git=hub so that I don't always have to use hub.

Now it broke...

I have tried reinstalling gitsome, but the issue still occurs. Any help?
gif

Also, I was using it on windows. I looked here on how to add it back, but I simply can't find any of the paths in:

    'BASH_COMPLETIONS': (('/usr/local/etc/bash_completion',
                             '/opt/local/etc/profile.d/bash_completion.sh',
                             '/usr/local/etc/bash_completion.d/git-completion.bash')
                        if ON_MAC else
                        ('/usr/share/bash-completion/bash_completion',
                             '/usr/share/bash-completion/completions/git')
                        if ON_ARCH else
                        ('/etc/bash_completion',
                             '/usr/share/bash-completion/completions/git')),

support 2fa

if 2factor authentication is enabled when login in with password, the response will be 401 with X-GitHub-OTP header set, typically having required; sms as a values (not sure what other authentication methods are available, but at least you get the require ;.)

So typically you need to reissue the request with the received OTP, typically:

if response.status_code == 401 and response.headers.get('X-GitHub-OTP') == 'required; sms':
        print("Your login API resquest a SMS one time password")
        sms_pw = getpass.getpass("SMS password: ")
        response = requests.post('https://api.github.com/authorizations',
                            auth=(user, pw), 
                            data=json.dumps(auth_request),
                            headers={'X-GitHub-OTP':sms_pw})

Not sure where that would be in here, likely around lib/github3/....

Note that I already do receive the OTP by SMS, the codepath just don't handle the 401 and print a :

Authentication error.
Update your credentials in ~/.gitsomeconfig or run:
  gh configure
Authentication error.
Update your credentials in ~/.gitsomeconfig or run:
  gh configure
Authentication error.
Update your credentials in ~/.gitsomeconfig or run:
  gh configure

(Note, the following message is unclear:

Do you want to log in with a password?
 If not, you will be prompted for a personal access token instead [Y/n]:

It reads to me as I will store username and password, while you do not actually store the password, but request a personal token that you store. I would suggest changing the phrasing slightly.

Thanks.

Add xonsh copyright notice

xonsh is distributed under a BSD license:

Copyright 2015, the xonsh developers. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of
    conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list
    of conditions and the following disclaimer in the documentation and/or other materials
    provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE XONSH DEVELOPERS ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE XONSH DEVELOPERS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those of the
authors and should not be interpreted as representing official policies, either expressed
or implied, of the stakeholders of the xonsh project or the employers of xonsh developers.

Typo in the docstring

In the function responsible for the command gh feed, the short form of the flag --private is written as -p, which is same as the flag --pager.

It should be replaced with its correct representation -pr.

You can see the typo in the line 203 of file githubcli.py.

gh feed command improvements

 $ gh feed donnemartin/gitsome -p

Newlines

Newlines are stripped for compatibility with click.wrap_text. A space should be added in their place for legibility instead of removing them entirely

Tags

Shows:

1. donnemartin released donnemartin/gitsome (24 minutes ago)

Should be:

1. donnemartin released 0.5.0 at donnemartin/gitsome (24 minutes ago)

Pull requests and issue titles:

3. donnemartin closed pull request repos/donnemartin/gitsome#45 (4 minutes ago)

Should be:

3.   donnemartin closed pull request repos/donnemartin/gitsome#45 (4 minutes ago)
         Add Terms of Service and Privacy policy

Commit/pull request comments:

72. janschulz commented on commit ac286ac at donnemartin/gitsome (Yesterday)

Should be:

72.  janschulz commented on commit ac286ac at donnemartin/gitsome (Yesterday)
         @donnemartin: Is there any reason for the `==`dependencies
         or can these be changed to `>=`? I', trying to package this for the
         conda-forge ecosystem and e.g. the requests dependency downgrades my
         conda root environment requests install :-/

Fix Codecov ignore settings for external libraries

Running coverage locally results in a 93% coverage rate.

Name                                                               Stmts   Miss  Cover
--------------------------------------------------------------------------------------
.tox/py35/lib/python3.5/site-packages/gitsome/__init__.py              1      0   100%
.tox/py35/lib/python3.5/site-packages/gitsome/completer.py            73      4    95%
.tox/py35/lib/python3.5/site-packages/gitsome/completions.py          12      0   100%
.tox/py35/lib/python3.5/site-packages/gitsome/completions_git.py       2      0   100%
.tox/py35/lib/python3.5/site-packages/gitsome/config.py              254     30    88%
.tox/py35/lib/python3.5/site-packages/gitsome/formatter.py           218      4    98%
.tox/py35/lib/python3.5/site-packages/gitsome/github.py              285     26    91%
.tox/py35/lib/python3.5/site-packages/gitsome/githubcli.py           158      0   100%
.tox/py35/lib/python3.5/site-packages/gitsome/rss_feed.py              1      0   100%
.tox/py35/lib/python3.5/site-packages/gitsome/table.py                69      7    90%
.tox/py35/lib/python3.5/site-packages/gitsome/utils.py                63      6    90%
.tox/py35/lib/python3.5/site-packages/gitsome/view_entry.py           16      2    88%
.tox/py35/lib/python3.5/site-packages/gitsome/web_viewer.py           72      3    96%
--------------------------------------------------------------------------------------
TOTAL                                                               1224     82    93%

Codecov is showing 51% coverage since it isn't properly excluding external libraries in the gitsome/lib folder.

The ignores in codecov.yml don't seem to be working.

Docs reference.

Xonsh dependency

Would it be possible to have xonsh as a dependency?
I run my own copy of bleeding edge xonsh and would love to layer this on top of my existing copy.

Question about auto completion

Sorry about the generic title.

If I want to add auto completion for a cli tool I use. Should I add the code as a PR to your repo? Or do you plan to make some kind of plugin support so people doesn't pollute this repo with everything?

Anyways. Good work on gitsome!

Compatibility between gitsome and haxor-news

It seems that both these use different versions of the prompt-toolkit which does not allow both to coexist simultaneously.

haxor-news uses 0.52
gitsome uses 0.51

I hope this compatibility issue can be resolved!

(I don't know if this is a valid issue to be posted here. But since they are both awesome tools developed by the same developer, I think this is a good place to post it.)

Duplicate Entries?

I got some duplicate entries in the gh search repo command. 🤔

  98.  idan/djoosh (Python)
        Stars: 32     Forks: 1      Updated: 5 month(s) ago 
  99.  brosner/django-mailer (Python)
        Stars: 32     Forks: 7      Updated: 5 month(s) ago 
  100. alex/django-resume-builder (Python)
        Stars: 32     Forks: 4      Updated: 5 month(s) ago 
  101. alex/django-resume-builder (Python)
        Stars: 32     Forks: 4      Updated: 5 month(s) ago 
  102. drslump/pyshould (Python)
        Stars: 32     Forks: 6      Updated: 2 month(s) ago 
  103. dndx/xiamiurl (Python)
        Stars: 32     Forks: 8      Updated: 1 year(s) ago 
  104. nskrypnik/kivy3 (Python)
        Stars: 32     Forks: 14     Updated: 1 month(s) ago 

I don't know whether this result is mistake of application or the API, can't say if it is a mistake or not.
Just reporting this so have a look at it. @donnemartin
🧀

Release 0.6.0 on GitHub and PyPI

Changelog

0.6.0 (2016-05-29)

Features

  • #3 - Add GitHub Enterprise support.
  • #33 - Revamp the info shown with the gh feed command.

Bug Fixes

  • #30 - Fix a typo in the pip3 install instructions.
  • #39 - Fix gh feed -pr/--private flag in docs.
  • #40 - Fix create-issue NoneType error if no -b/--body is specified.
  • #46 - Fix gh view with the -b/--browser option only working for repos, not for issues or PRs.
  • #48 - Fix create-repo NoneType error if no -d/--description is specified.
  • #54 - Update to prompt-toolkit 1.0.0, which includes performance improvements (especially noticeable on Windows) and bug fixes.
  • Fix Config docstrings.

Updates

  • #26, #32 - Add copyright notices for third
    party libraries.
  • #44, #53 - Update packaging dependencies based on semantic versioning.
  • Tweak README intro.

Use current .git as default

When using commands that require a repo/context, the current git remotes should be used.
E.g. when I type gh issues in the local git directory of a github project, it should list
all the issues of that project. Same with gh repo and similar commands.

Syntaxerror when parsing received XML

Arch Linux, Python 3.5.1, zsh 5.2, gitsome 0.5.0, pip 8.1.2

Error:

Traceback (most recent call last):
  File "/usr/bin/gh", line 9, in <module>
    load_entry_point('gitsome==0.5.0', 'console_scripts', 'gh')()
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3.5/site-packages/gitsome/main_cli.py", line 20, in <module>
    from .githubcli import GitHubCli
  File "/usr/lib/python3.5/site-packages/gitsome/githubcli.py", line 23, in <module>
    from .github import GitHub
  File "/usr/lib/python3.5/site-packages/gitsome/github.py", line 31, in <module>
    import feedparser
  File "/usr/lib/python3.5/site-packages/feedparser.py", line 188, in <module>
    xml.sax.make_parser(PREFERRED_XML_PARSERS) # test for valid parsers
  File "/usr/lib/python3.5/xml/sax/__init__.py", line 80, in make_parser
    return _create_parser(parser_name)
  File "/usr/lib/python3.5/xml/sax/__init__.py", line 104, in _create_parser
    drv_module = __import__(parser_name,{},{},['create_parser'])
  File "/usr/lib/python3.5/site-packages/drv_libxml2.py", line 75, in <module>
    import libxml2
  File "/usr/lib/python3.5/site-packages/libxml2.py", line 9326
    XML_CHAR_ENCODING_ASCII XML_T
                                ^
SyntaxError: invalid syntax

I tried reinstalling, but same error. I get this with any command, and even if I try to do autocompletion. I had already added the ZSH compatibility line:

autoload bashcompinit
bashcompinit
source $HOME/dotfiles/tools/gh_complete.sh

What's weird, is that it did work for like a day, when I first installed it maybe a few days ago. Tried it now, and doesn't work. I'd say it might be a breaking change for some XML parser or for the Github API, but I dunno.

missing context of the repo

The one issue I have is, is when I look for issues and I'm in a git repo on my local filesystem, I want to see those issues without having to manually specify the repo number. If everything could use that context by default, I would switch to you guys in a heartbeat.

The current one I use is https://github.com/node-gh/gh and they do that

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.