bin: improve utils for roam
This commit is contained in:
parent
9d36a94b1a
commit
61c2591277
|
@ -1,5 +1,8 @@
|
|||
#!/bin/sh
|
||||
# Stage moved files fitting the already staged ones
|
||||
git diff --name-only --cached >/tmp/staged
|
||||
git add $(git rev-parse --show-toplevel)
|
||||
git status -s | tail +2 | grep -vf /tmp/staged | cut -c4- | sed 's/ -> /\n/' | xargs git restore --staged
|
||||
root=$(git rev-parse --show-toplevel)
|
||||
git add "$root"
|
||||
git status --porcelain --find-renames=.3 |
|
||||
grep -vf /tmp/staged | cut -c4- | sed 's/ -> /\n/' |
|
||||
xargs git -C "$root" restore --staged
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#!/bin/sh -e
|
||||
# Move roam files into subfolders
|
||||
cd $DATA/2-standards/notes
|
||||
find . -mindepth 1 -type d -printf '%f\n' | while read dir; do grep -l --directories=skip "#+filetags: :$dir" * | xargs --verbose --no-run-if-empty mv -t "$dir"; done
|
||||
find . -mindepth 1 -type d -printf '%f\n' |
|
||||
while read dir; do
|
||||
grep -l --directories=skip "#+filetags: :$dir" * |
|
||||
xargs --verbose --no-run-if-empty mv -t "$dir"
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue