diff --git a/README.md b/README.md index 7088cfc..504073d 100644 --- a/README.md +++ b/README.md @@ -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-) @@ -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 diff --git a/github_release.py b/github_release.py index 102a7a9..b6c1aeb 100755 --- a/github_release.py +++ b/github_release.py @@ -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 # @@ -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(