Skip to content

Commit 8425550

Browse files
committed
auto-completion, cross-platform
1 parent afebd2d commit 8425550

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ git pad list
187187

188188
## To-Dos <small><sup>[](#table-of-contents)</sup></small>
189189

190-
* ~~auto-completion~~ : enable <TAB> after `git pad` or `git pad edit`
190+
* ~~auto-completion~~ : enable `<TAB>` after `git pad` or `git pad edit`
191191

192192
* Different Template for Issue types
193193
* Current, only one `TEMPLATE.md` for all issues

install.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
# shellcheck disable=SC2016
33
if [ ! -f "git-pad" ] || [ ! -f "autocompletion.sh" ]; then
44
echo '!E: Not in git-pad directory';
@@ -9,7 +9,7 @@ block='
99
## git-pad
1010
PATH=$PATH:'"$PWD"';
1111
export PATH;
12-
source '"$(realpath autocompletion.sh);"
12+
. '"$PWD/autocompletion.sh;"
1313

1414
shell_name="$(basename "$SHELL")"
1515

@@ -19,4 +19,10 @@ case "$shell_name" in
1919
*) echo "Unsupported shell"; exit 1 ;;
2020
esac
2121

22-
grep -q '## git-pad' "$rc" 2>/dev/null || echo "$block" >> "$rc"
22+
if grep -q '## git-pad' "$rc" 2>/dev/null; then
23+
echo '!W: Looks like it is already installed'
24+
echo '--------------------------------------'
25+
grep -C 5 '## git-pad' "$rc"
26+
else
27+
echo "$block" >> "$rc" && echo "Installed successfully. Restart your shell."
28+
fi

test_completion.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ source ./autocompletion.sh
2020

2121
# Simulate:
2222
# git pad e<TAB>
23+
echo '- Testing git pad e<TAB>'
2324
COMP_WORDS=(git pad e)
2425
COMP_CWORD=2
2526
COMP_LINE="git pad e"

0 commit comments

Comments
 (0)