diff options
| author | EuAndreh <eu@euandre.org> | 2021-06-15 09:36:03 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2021-06-15 09:36:03 -0300 |
| commit | 3e0715604dc36f30b7464949d77a3ccb0083f440 (patch) | |
| tree | 329be825a63767b1f3a8f70bb0ad37df4d66072d | |
| parent | sh/fzf.sh: Improve fcm(), rename to cm() (diff) | |
| download | dotfiles-3e0715604dc36f30b7464949d77a3ccb0083f440.tar.gz dotfiles-3e0715604dc36f30b7464949d77a3ccb0083f440.tar.xz | |
sh/fzf.sh: Create separate cn() (commit number) and cm() (commit) functions
| -rwxr-xr-x | scripts/pastebin (renamed from scripts/pastebin.sh) | 10 | ||||
| -rw-r--r-- | sh/fzf.sh | 9 |
2 files changed, 11 insertions, 8 deletions
diff --git a/scripts/pastebin.sh b/scripts/pastebin index d306f87..319b126 100755 --- a/scripts/pastebin.sh +++ b/scripts/pastebin @@ -6,7 +6,7 @@ usage() { Missing argument <$1>. Usage: - pastebin.sh <FULL_TITLE> [-|FILE] + $0 <FULL_TITLE> [-|FILE] Reads contents from [FILE], from stdin if '-' is given, and opens the editor on the content. @@ -15,9 +15,9 @@ Usage: FULL_TITLE Full title of the pastebin Examples: - pastebin.sh 'My example pastebin title' - pastebin.sh 'My example pastebin title' - < file - cat file | pastebin.sh 'My example pastebin title' - + pastebin 'My example pastebin title' + pastebin 'My example pastebin title' - < file + cat file | pastebin 'My example pastebin title' - EOF } @@ -79,6 +79,6 @@ EOF git reset . git add "$OUT" git commit -m "$0: Auto-add $OUT" -make publish +make clean publish open "https://euandre.org/pastebin/$(echo "$PASTE_DATE" | tr '-' '/')/$SLUG_TITLE.html" cd - > /dev/null @@ -67,8 +67,11 @@ v() { fi } -cm() { +cn() { CHOICE="$(git log --oneline | fzf)" - INDEX="$(git log --oneline | grep -nF "$CHOICE" | cut -d: -f1)" - git rev-parse "HEAD~$INDEX" + git log --oneline | grep -nF "$CHOICE" | cut -d: -f1 +} + +cm() { + git rev-parse "HEAD~$(cn)" } |
