-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fdd66c
commit 34e0476
Showing
2 changed files
with
105 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,77 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
import getpass | ||
import json | ||
import logging | ||
import sys | ||
|
||
from githubcollaborators import githubcollaborators | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser( | ||
description="""List collaborators for all repositories for the given | ||
user. Might take a while to run, be patient.""" | ||
) | ||
parser.add_argument( | ||
"-u", | ||
"--username", | ||
required=True, | ||
help="GitHub username" | ||
) | ||
parser.add_argument( | ||
"-t", | ||
"--token", | ||
required=False, | ||
help="""Personal Access Token for the specified GitHub username. | ||
Requires following permissions: repo("Full control of private | ||
repositories"), admin: org -> read: org("Read or and team | ||
membership, read org projects"), user -> read: user("Read all user | ||
profile data")""" | ||
) | ||
parser.add_argument( | ||
"-v", | ||
"--visibility", | ||
required=False, | ||
help="Visibility level of the repositories, can be: all, public, or private" | ||
) | ||
parser.add_argument( | ||
"-o", | ||
"--output", | ||
required=False, | ||
help="Save to specified output file" | ||
) | ||
parser.add_argument( | ||
"--verbose", | ||
action="store_true", | ||
help="Set logging level to INFO" | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
# Logging config | ||
logger = logging.getLogger("githubcollaborators") | ||
if args.verbose: | ||
logger.setLevel(logging.INFO) | ||
else: | ||
logger.setLevel(logging.ERROR) | ||
handler = logging.StreamHandler(sys.stderr) | ||
handler.setFormatter(logging.Formatter("[%(levelname)s]: %(message)s")) | ||
logger.addHandler(handler) | ||
|
||
token = getpass.getpass( | ||
"GitHub Personal Access Token:") if args.token is None else args.token | ||
|
||
repos_with_collaborators = githubcollaborators( | ||
args.username, token, logger_obj=logger) | ||
|
||
if args.output is not None: | ||
with open(args.output, "w") as f: | ||
json.dump(repos_with_collaborators, f, indent=2, sort_keys=True) | ||
else: | ||
print(json.dumps(repos_with_collaborators, indent=2, sort_keys=True)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
import getpass | ||
import json | ||
import logging | ||
import sys | ||
|
||
from githubcollaborators import githubcollaborators | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser( | ||
description="""List collaborators for all repositories for the given | ||
user. Might take a while to run, be patient.""" | ||
) | ||
parser.add_argument( | ||
"-u", | ||
"--username", | ||
required=True, | ||
help="GitHub username" | ||
) | ||
parser.add_argument( | ||
"-t", | ||
"--token", | ||
required=False, | ||
help="""Personal Access Token for the specified GitHub username. | ||
Requires following permissions: repo("Full control of private | ||
repositories"), admin: org -> read: org("Read or and team | ||
membership, read org projects"), user -> read: user("Read all user | ||
profile data")""" | ||
) | ||
parser.add_argument( | ||
"-v", | ||
"--visibility", | ||
required=False, | ||
help="Visibility level of the repositories, can be: all, public, or private" | ||
) | ||
parser.add_argument( | ||
"-o", | ||
"--output", | ||
required=False, | ||
help="Save to specified output file" | ||
) | ||
parser.add_argument( | ||
"--verbose", | ||
action="store_true", | ||
help="Set logging level to INFO" | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
# Logging config | ||
logger = logging.getLogger("githubcollaborators") | ||
if args.verbose: | ||
logger.setLevel(logging.INFO) | ||
else: | ||
logger.setLevel(logging.ERROR) | ||
handler = logging.StreamHandler(sys.stderr) | ||
handler.setFormatter(logging.Formatter("[%(levelname)s]: %(message)s")) | ||
logger.addHandler(handler) | ||
|
||
token = getpass.getpass( | ||
"GitHub Personal Access Token:") if args.token is None else args.token | ||
|
||
repos_with_collaborators = githubcollaborators( | ||
args.username, token, logger_obj=logger) | ||
|
||
if args.output is not None: | ||
with open(args.output, "w") as f: | ||
json.dump(repos_with_collaborators, f, indent=2, sort_keys=True) | ||
else: | ||
print(json.dumps(repos_with_collaborators, indent=2, sort_keys=True)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
import setuptools | ||
|
||
with open("README.md", "r") as fh: | ||
long_description = fh.read() | ||
|
||
setuptools.setup( | ||
name="githubcollaborators", | ||
version="0.0.1", | ||
author="Marco Lussetti", | ||
author_email="packages@marcolussetti.com", | ||
description="List collaborators for all of a user's repositories.", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/marcolussetti/githubcollaborators", | ||
packages=setuptools.find_packages(), | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
], | ||
python_requires='>=3.6', | ||
scripts=[ | ||
'bin/githubcollaborators' | ||
], | ||
install_requires=[ | ||
'requests' | ||
] | ||
) | ||
import setuptools | ||
|
||
with open("README.md", "r") as fh: | ||
long_description = fh.read() | ||
|
||
setuptools.setup( | ||
name="githubcollaborators", | ||
version="0.0.2", | ||
author="Marco Lussetti", | ||
author_email="packages@marcolussetti.com", | ||
description="List collaborators for all of a user's repositories.", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/marcolussetti/githubcollaborators", | ||
packages=setuptools.find_packages(), | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
], | ||
python_requires='>=3.6', | ||
scripts=[ | ||
'bin/githubcollaborators' | ||
], | ||
install_requires=[ | ||
'requests' | ||
] | ||
) |