From 2593dcdf47ec25222396f9113ca5696ec15df35e Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 13 Dec 2021 21:50:28 +0800 Subject: Fix pattern check for token Currently, Github might have token in the following format: ghp_I1M4zc8z4Qi8c5KNf93KyBHGkP9Azq00Bup1 So we need to include underscore. Also, add pattern for hyphen and consider the case more than 40 characters. --- gist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gist b/gist index c2f6e5f..c38d5b8 100755 --- a/gist +++ b/gist @@ -178,7 +178,7 @@ _ask_token() { python -mwebbrowser https://github.com/settings/tokens/new?scopes=gist fi - while [[ ! $token =~ ^[[:alnum:]]{40}$ ]]; do + while [[ ! $token =~ ^[[:alnum:]_-]{40,}$ ]]; do [[ -n $token ]] && echo "Invalid token" read -r -p "Paste your token here (Ctrl-C to skip): " token