diff --git a/github_users.py b/github_users.py index 64c4d64..7ac4e25 100644 --- a/github_users.py +++ b/github_users.py @@ -17,6 +17,7 @@ class Application(object): DEFAULT_FIELD_NAMES = ['name', 'login'] + VERSION = '0.0.2' def __init__(self, github_token): """ @@ -48,7 +49,7 @@ def _get_users(self, org_name, field_names=DEFAULT_FIELD_NAMES): # Find the organization with the given name # GOTCHA: Assumes the given name is exact and looks for a perfect match # GOTCHA: Assumes there is only 1 organization with the given name - org = [org for org in self._github.iter_orgs(login=self._me.login) if org.login == org_name][0] + org = [org for org in self._github.iter_orgs() if org.login == org_name][0] for user in org.iter_members(): # For every user, grab the whole user object and yield @@ -186,6 +187,9 @@ def pprint(self, org_name, output=None, field_names=DEFAULT_FIELD_NAMES, *args, '(default: ' + str(Application.DEFAULT_FIELD_NAMES) + ')' ) ) +@click.version_option( + version=Application.VERSION, +) def main(org_name, github_token, output_format, output, field_names): """ Prints out a list of users in the given GitHub organization. diff --git a/setup.py b/setup.py index e3bc298..708eb79 100644 --- a/setup.py +++ b/setup.py @@ -2,10 +2,11 @@ from __future__ import absolute_import from setuptools import setup +from github_users import Application # We use the version to construct the DOWNLOAD_URL. -VERSION = '0.0.1' +VERSION = Application.VERSION # URL to the repository on Github. REPO_URL = 'https://github.com/hanpeter/github-users'