Skip to content

Commit 77ede50

Browse files
authored
Merge pull request josegonzalez#52 from bjodah/fix-gh-51
Support --token file:///home/user/token.txt (fixes josegonzalezgh-51)
2 parents 03604cc + 97e4fbb commit 77ede50

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

bin/github-backup

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def parse_args():
141141
parser.add_argument('-t',
142142
'--token',
143143
dest='token',
144-
help='personal access or OAuth token')
144+
help='personal access or OAuth token, or path to token (file://...)')
145145
parser.add_argument('-o',
146146
'--output-directory',
147147
default='.',
@@ -255,6 +255,10 @@ def get_auth(args, encode=True):
255255
auth = None
256256

257257
if args.token:
258+
_path_specifier = 'file://'
259+
if args.token.startswith(_path_specifier):
260+
args.token = open(args.token[len(_path_specifier):],
261+
'rt').readline().strip()
258262
auth = args.token + ':' + 'x-oauth-basic'
259263
elif args.username:
260264
if not args.password:

0 commit comments

Comments
 (0)