-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgh-shorthand.sh
executable file
·39 lines (29 loc) · 1.03 KB
/
gh-shorthand.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
set -e
rm -f ~/.gh-shorthand.yml
editor=$(which code-insiders || which code)
cat > ~/.gh-shorthand.yml << EOF
---
# The default repository, if none is provided. This can be empty/unset.
# default_repo:
# The repository shorthand map
repos:
# gs: "zerowidth/gh-shorthand"
# The user shorthand map
users:
tp: technicalpickles
# Project directory listing:
project_dirs:
- ~/src/*
# The command or script to open the editor.
editor: "${editor} -n"
# GitHub API token (requires 'read:org,repo,user' permission)
# enables live search results and annotations
EOF
# FIXME when empty, this fails and stops the script with:
# SecKeychainSearchCopyNext: The specified item could not be found in the keychain
token=$(security find-internet-password -a technicalpickles -s github.com -l 'gh-shorthand token' -w)
if [ -z "$token" ]; then
echo "missing Token. Run the following to set: security add-internet-password -a technicalpickles -s github.com -l 'gh-shorthand token' -w"
fi
echo "token: ${token}" >> ~/.gh-shorthand.yml