mirror of
https://github.com/jbranchaud/til
synced 2026-07-06 01:00:35 +00:00
Create a shared task to deduplicate logic listing recent TILs
This commit is contained in:
+15
-13
@@ -11,33 +11,35 @@ tasks:
|
|||||||
cmds:
|
cmds:
|
||||||
- task --list
|
- task --list
|
||||||
|
|
||||||
browse:
|
browse:list:
|
||||||
desc: Pick from 5 most recent TILs (fzf) and open in browser
|
desc: Print deduped, newest-first TIL paths
|
||||||
|
silent: true
|
||||||
cmds:
|
cmds:
|
||||||
- |
|
- |
|
||||||
FILE=$(git log --diff-filter=A --name-only --pretty=format: -- '*/*.md' \
|
git log --diff-filter=A --name-only --pretty=format: -- '*/*.md' \
|
||||||
| grep -v '^$' \
|
| grep -v '^$' \
|
||||||
| awk '!seen[$0]++' \
|
| awk '!seen[$0]++'
|
||||||
| head -5 \
|
|
||||||
| fzf --prompt="Open TIL: " --height=40% --reverse) || true
|
browse:
|
||||||
|
desc: Pick from 5 most recent TILs (fzf) and open in browser
|
||||||
|
interactive: true
|
||||||
|
silent: true
|
||||||
|
cmds:
|
||||||
|
- |
|
||||||
|
FILE=$(task browse:list | head -5 | fzf --prompt="Open TIL: " --height=40% --reverse) || true
|
||||||
if [ -n "$FILE" ]; then
|
if [ -n "$FILE" ]; then
|
||||||
gh browse "$FILE"
|
gh browse "$FILE"
|
||||||
fi
|
fi
|
||||||
interactive: true
|
|
||||||
silent: true
|
|
||||||
|
|
||||||
browse:latest:
|
browse:latest:
|
||||||
desc: Open the single most recent TIL in the browser
|
desc: Open the single most recent TIL in the browser
|
||||||
|
silent: true
|
||||||
cmds:
|
cmds:
|
||||||
- |
|
- |
|
||||||
FILE=$(git log --diff-filter=A --name-only --pretty=format: -- '*/*.md' \
|
FILE=$(task browse:list | head -1)
|
||||||
| grep -v '^$' \
|
|
||||||
| awk '!seen[$0]++' \
|
|
||||||
| head -1)
|
|
||||||
if [ -n "$FILE" ]; then
|
if [ -n "$FILE" ]; then
|
||||||
gh browse "$FILE"
|
gh browse "$FILE"
|
||||||
fi
|
fi
|
||||||
silent: true
|
|
||||||
|
|
||||||
notes:
|
notes:
|
||||||
desc: Interactive picker for notes tasks
|
desc: Interactive picker for notes tasks
|
||||||
|
|||||||
Reference in New Issue
Block a user