| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b77ea48 commit eca9f0f
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,12 +28,12 @@ Usage | |||
| 28 | 28 | CLI Usage is as follows:: | |
| 29 | 29 | ||
| 30 | 30 | github-backup [-h] [-u USERNAME] [-p PASSWORD] [-t TOKEN] | |
| 31 | - [-o OUTPUT_DIRECTORY] [-i] [--starred] [--watched] | ||
| 32 | - [--all] [--issues] [--issue-comments] [--issue-events] | ||
| 33 | - [--pulls] [--pull-comments] [--pull-commits] [--labels] | ||
| 34 | - [--hooks] [--milestones] [--repositories] [--bare] [--lfs] | ||
| 35 | - [--wikis] [--skip-existing] [--all-starred] | ||
| 36 | - [--gists] [--starred-gists] | ||
| 31 | + [-o OUTPUT_DIRECTORY] [-i] [--starred] [--all-starred] | ||
| 32 | + [--watched] [--followers] [--following] [--all] | ||
| 33 | + [--issues] [--issue-comments] [--issue-events] [--pulls] | ||
| 34 | + [--pull-comments] [--pull-commits] [--labels] [--hooks] | ||
| 35 | + [--milestones] [--repositories] [--bare] [--lfs] | ||
| 36 | + [--wikis] [--gists] [--starred-gists] [--skip-existing] | ||
| 37 | 37 | [-L [LANGUAGES [LANGUAGES ...]]] [-N NAME_REGEX] | |
| 38 | 38 | [-H GITHUB_HOST] [-O] [-R REPOSITORY] [-P] [-F] | |
| 39 | 39 | [--prefer-ssh] [-v] | |
@@ -54,12 +54,16 @@ CLI Usage is as follows:: | |||
| 54 | 54 | password for basic auth. If a username is given but | |
| 55 | 55 | not a password, the password will be prompted for. | |
| 56 | 56 | -t TOKEN, --token TOKEN | |
| 57 | - personal access or OAuth token | ||
| 57 | + personal access or OAuth token, or path to token | ||
| 58 | + (file://...) | ||
| 58 | 59 | -o OUTPUT_DIRECTORY, --output-directory OUTPUT_DIRECTORY | |
| 59 | 60 | directory at which to backup the repositories | |
| 60 | 61 | -i, --incremental incremental backup | |
| 61 | 62 | --starred include JSON output of starred repositories in backup | |
| 63 | + --all-starred include starred repositories in backup | ||
| 62 | 64 | --watched include watched repositories in backup | |
| 65 | + --followers include JSON output of followers in backup | ||
| 66 | + --following include JSON output of following users in backup | ||
| 63 | 67 | --all include everything in backup | |
| 64 | 68 | --issues include issues in backup | |
| 65 | 69 | --issue-comments include issue comments in backup | |
@@ -73,12 +77,12 @@ CLI Usage is as follows:: | |||
| 73 | 77 | --milestones include milestones in backup | |
| 74 | 78 | --repositories include repository clone in backup | |
| 75 | 79 | --bare clone bare repositories | |
| 76 | - --lfs clone LFS repositories (requires Git LFS to be installed, https://git-lfs.github.com) | ||
| 80 | + --lfs clone LFS repositories (requires Git LFS to be | ||
| 81 | + installed, https://git-lfs.github.com) | ||
| 77 | 82 | --wikis include wiki clone in backup | |
| 78 | - --skip-existing skip project if a backup directory exists | ||
| 79 | - --all-starred include starred repositories in backup | ||
| 80 | 83 | --gists include gists in backup | |
| 81 | 84 | --starred-gists include starred gists in backup | |
| 85 | + --skip-existing skip project if a backup directory exists | ||
| 82 | 86 | -L [LANGUAGES [LANGUAGES ...]], --languages [LANGUAGES [LANGUAGES ...]] | |
| 83 | 87 | only allow these languages | |
| 84 | 88 | -N NAME_REGEX, --name-regex NAME_REGEX | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -168,6 +168,14 @@ def parse_args(): | |||
| 168 | 168 | action='store_true', | |
| 169 | 169 | dest='include_watched', | |
| 170 | 170 | help='include watched repositories in backup') | |
| 171 | + parser.add_argument('--followers', | ||
| 172 | + action='store_true', | ||
| 173 | + dest='include_followers', | ||
| 174 | + help='include JSON output of followers in backup') | ||
| 175 | + parser.add_argument('--following', | ||
| 176 | + action='store_true', | ||
| 177 | + dest='include_following', | ||
| 178 | + help='include JSON output of following users in backup') | ||
| 171 | 179 | parser.add_argument('--all', | |
| 172 | 180 | action='store_true', | |
| 173 | 181 | dest='include_everything', | |
@@ -886,25 +894,41 @@ def backup_account(args, output_directory): | |||
| 886 | 894 | account_cwd = os.path.join(output_directory, 'account') | |
| 887 | 895 | ||
| 888 | 896 | if args.include_starred or args.include_everything: | |
| 889 | - output_file = '{0}/starred.json'.format(account_cwd) | ||
| 890 | - template = "https://{0}/users/{1}/starred" | ||
| 891 | - template = template.format(get_github_api_host(args), args.user) | ||
| 897 | + output_file = "{0}/starred.json".format(account_cwd) | ||
| 898 | + template = "https://{0}/users/{1}/starred".format(get_github_api_host(args), args.user) | ||
| 892 | 899 | _backup_data(args, | |
| 893 | - 'starred repositories', | ||
| 900 | + "starred repositories", | ||
| 894 | 901 | template, | |
| 895 | 902 | output_file, | |
| 896 | 903 | account_cwd) | |
| 897 | 904 | ||
| 898 | 905 | if args.include_watched or args.include_everything: | |
| 899 | - output_file = '{0}/watched.json'.format(account_cwd) | ||
| 900 | - template = "https://{0}/users/{1}/subscriptions" | ||
| 901 | - template = template.format(get_github_api_host(args), args.user) | ||
| 906 | + output_file = "{0}/watched.json".format(account_cwd) | ||
| 907 | + template = "https://{0}/users/{1}/subscriptions".format(get_github_api_host(args), args.user) | ||
| 902 | 908 | _backup_data(args, | |
| 903 | - 'watched repositories', | ||
| 909 | + "watched repositories", | ||
| 904 | 910 | template, | |
| 905 | 911 | output_file, | |
| 906 | 912 | account_cwd) | |
| 907 | 913 | ||
| 914 | + if args.include_followers or args.include_everything: | ||
| 915 | + output_file = "{0}/followers.json".format(account_cwd) | ||
| 916 | + template = "https://{0}/users/{1}/followers".format(get_github_api_host(args), args.user) | ||
| 917 | + _backup_data(args, | ||
| 918 | + "followers", | ||
| 919 | + template, | ||
| 920 | + output_file, | ||
| 921 | + account_cwd) | ||
| 922 | + | ||
| 923 | + if args.include_following or args.include_everything: | ||
| 924 | + output_file = "{0}/following.json".format(account_cwd) | ||
| 925 | + template = "https://{0}/users/{1}/following".format(get_github_api_host(args), args.user) | ||
| 926 | + _backup_data(args, | ||
| 927 | + "following", | ||
| 928 | + template, | ||
| 929 | + output_file, | ||
| 930 | + account_cwd) | ||
| 931 | + | ||
| 908 | 932 | ||
| 909 | 933 | def _backup_data(args, name, template, output_file, output_directory): | |
| 910 | 934 | skip_existing = args.skip_existing | |
| Back | FazBrowse Home | New Git URL |
0 commit comments