Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Python, you should probably look into project like [github3py](http://github3py.
* [release command](#release-command)
* [asset command](#asset-command)
* [ref command](#ref-command)
* [commit command](#commit-command)
* [using the module](#using-the-module)
* [testing](#testing)
* [maintainers: how to make a release ?](#maintainers-how-to-make-a-release-)
Expand Down Expand Up @@ -271,6 +272,21 @@ It understands the following commands:
| delete | pattern [--tags] [--keep-pattern KEEP_PATTERN] | delete selected references |


## ``commit`` command

This command deals with git commits. The general usage is:

```bash
githubrelease commit username/reponame command [options]
```

It understands the following commands:

| command | parameters | description |
|-----------|----------------------------------------|--------------------------------------------|
| get | sha | get commit properties |


# using the module

The python API mirrors the command-line interface. Most of the available
Expand Down
23 changes: 23 additions & 0 deletions github_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@ def gh_ref(ctx, repo_name):
ctx.obj = repo_name


@main.group("commit")
@click.argument('repo_name', metavar="REPOSITORY")
@click.pass_context
@handle_http_error
def gh_commit(ctx, repo_name):
"""Manage commits (get) for
REPOSITORY (e.g jcfr/sandbox)
"""
ctx.obj = repo_name


#
# Releases
#
Expand Down Expand Up @@ -1029,6 +1040,18 @@ def gh_ref_delete(repo_name, pattern, keep_pattern=None, tags=False,
# Commits
#

@gh_commit.command("get")
@click.argument("sha")
@click.pass_obj
def _cli_commit_get(*args, **kwargs):
"""Get commit properties"""
commit = gh_commit_get(*args, **kwargs)
if commit is None:
print('could not find commit {0}'.format(kwargs['sha']))
return
print(commit)


def gh_commit_get(repo_name, sha):
try:
response = _request(
Expand Down