mirror of
https://github.com/josegonzalez/python-github-backup.git
synced 2025-12-06 00:28:01 +01:00
Add support for retrieving repositories. Closes #1
This commit is contained in:
13
README.rst
13
README.rst
@@ -21,12 +21,12 @@ Usage
|
|||||||
CLI Usage is as follows::
|
CLI Usage is as follows::
|
||||||
|
|
||||||
Github Backup [-h] [-u USERNAME] [-p PASSWORD] [-t TOKEN]
|
Github Backup [-h] [-u USERNAME] [-p PASSWORD] [-t TOKEN]
|
||||||
[-o OUTPUT_DIRECTORY] [--starred] [--watched] [--all]
|
[-o OUTPUT_DIRECTORY] [--starred] [--watched] [--all]
|
||||||
[--issues] [--issue-comments] [--issue-events]
|
[--issues] [--issue-comments] [--issue-events]
|
||||||
[--repositories] [--wikis] [--skip-existing]
|
[--repositories] [--wikis] [--skip-existing]
|
||||||
[-L [LANGUAGES [LANGUAGES ...]]] [-N NAME_REGEX]
|
[-L [LANGUAGES [LANGUAGES ...]]] [-N NAME_REGEX] [-O]
|
||||||
[-R REPOSITORY] [-P] [-F] [-v]
|
[-R REPOSITORY] [-P] [-F] [-v]
|
||||||
USER
|
USER
|
||||||
|
|
||||||
Backup a github users account
|
Backup a github users account
|
||||||
|
|
||||||
@@ -56,6 +56,7 @@ CLI Usage is as follows::
|
|||||||
only allow these languages
|
only allow these languages
|
||||||
-N NAME_REGEX, --name-regex NAME_REGEX
|
-N NAME_REGEX, --name-regex NAME_REGEX
|
||||||
python regex to match names against
|
python regex to match names against
|
||||||
|
-O, --organization whether or not this is a query for an organization
|
||||||
-R REPOSITORY, --repository REPOSITORY
|
-R REPOSITORY, --repository REPOSITORY
|
||||||
name of repository to limit backup to
|
name of repository to limit backup to
|
||||||
-P, --private include private repositories
|
-P, --private include private repositories
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ def parse_args():
|
|||||||
parser.add_argument('--skip-existing', action='store_true', dest='skip_existing', help='skip project if a backup directory exists')
|
parser.add_argument('--skip-existing', action='store_true', dest='skip_existing', help='skip project if a backup directory exists')
|
||||||
parser.add_argument('-L', '--languages', dest='languages', help='only allow these languages', nargs='*')
|
parser.add_argument('-L', '--languages', dest='languages', help='only allow these languages', nargs='*')
|
||||||
parser.add_argument('-N', '--name-regex', dest='name_regex', help='python regex to match names against')
|
parser.add_argument('-N', '--name-regex', dest='name_regex', help='python regex to match names against')
|
||||||
|
parser.add_argument('-O', '--organization', action='store_true', dest='organization', help='whether or not this is a query for an organization')
|
||||||
parser.add_argument('-R', '--repository', dest='repository', help='name of repository to limit backup to')
|
parser.add_argument('-R', '--repository', dest='repository', help='name of repository to limit backup to')
|
||||||
parser.add_argument('-P', '--private', action='store_true', dest='private', help='include private repositories')
|
parser.add_argument('-P', '--private', action='store_true', dest='private', help='include private repositories')
|
||||||
parser.add_argument('-F', '--fork', action='store_true', dest='fork', help='include forked repositories')
|
parser.add_argument('-F', '--fork', action='store_true', dest='fork', help='include forked repositories')
|
||||||
@@ -168,6 +169,8 @@ def retrieve_repositories(args):
|
|||||||
log_info('Retrieving repositories')
|
log_info('Retrieving repositories')
|
||||||
single_request = False
|
single_request = False
|
||||||
template = 'https://api.github.com/users/{0}/repos'.format(args.user)
|
template = 'https://api.github.com/users/{0}/repos'.format(args.user)
|
||||||
|
if args.organization:
|
||||||
|
template = 'https://api.github.com/orgs/{0}/repos'.format(args.user)
|
||||||
|
|
||||||
if args.repository:
|
if args.repository:
|
||||||
single_request = True
|
single_request = True
|
||||||
|
|||||||
Reference in New Issue
Block a user