From 97e4fbbacb8cd5d616b21c3a06c157b1f7067a75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Dahlgren?= Date: Wed, 26 Oct 2016 01:53:44 +0200 Subject: [PATCH] Support --token file:///home/user/token.txt (fixes gh-51) --- bin/github-backup | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/github-backup b/bin/github-backup index 169b8ac..63098cd 100755 --- a/bin/github-backup +++ b/bin/github-backup @@ -141,7 +141,7 @@ def parse_args(): parser.add_argument('-t', '--token', dest='token', - help='personal access or OAuth token') + help='personal access or OAuth token, or path to token (file://...)') parser.add_argument('-o', '--output-directory', default='.', @@ -255,6 +255,10 @@ def get_auth(args, encode=True): auth = None if args.token: + _path_specifier = 'file://' + if args.token.startswith(_path_specifier): + args.token = open(args.token[len(_path_specifier):], + 'rt').readline().strip() auth = args.token + ':' + 'x-oauth-basic' elif args.username: if not args.password: