2024-10-30 01:16:16 +01:00
|
|
|
with import <nixpkgs> {};
|
|
|
|
|
|
|
|
pkgs.writeShellScriptBin "plans" ''
|
|
|
|
#!/bin/sh
|
2024-10-30 01:31:11 +01:00
|
|
|
if [ "$1" = "help" ] ; then
|
|
|
|
echo "plans (tudbut)"
|
|
|
|
echo
|
|
|
|
echo "- add <str> -- add to end of list"
|
2024-10-31 17:39:26 +01:00
|
|
|
echo "- done [n] -- remove from list"
|
2024-10-30 01:31:11 +01:00
|
|
|
echo "- edit -- edit manually using helix"
|
2024-10-31 17:39:26 +01:00
|
|
|
echo "default prints list"
|
2024-10-30 01:31:11 +01:00
|
|
|
echo
|
|
|
|
echo "file used is ~/sync/plans.txt"
|
|
|
|
exit
|
|
|
|
fi
|
2024-10-30 01:16:16 +01:00
|
|
|
if [ "$1" = "add" ] ; then
|
2024-10-30 01:19:01 +01:00
|
|
|
echo "- $2" >> ~/sync/plans.txt
|
2024-10-30 01:16:16 +01:00
|
|
|
fi
|
|
|
|
if [ "$1" = "done" ] ; then
|
2024-10-31 17:39:26 +01:00
|
|
|
if [ "$2" != "" ] ; then
|
2024-10-31 17:46:22 +01:00
|
|
|
head -n $(($2 - 1)) ~/sync/plans.txt > ~/plans.txt.tmp
|
2024-10-31 17:39:26 +01:00
|
|
|
tail -n"$(($(wc -l < ~/sync/plans.txt) - $2))" ~/sync/plans.txt >> ~/plans.txt.tmp
|
|
|
|
else
|
|
|
|
tail -n"$(($(wc -l < ~/sync/plans.txt) - 1))" ~/sync/plans.txt > ~/plans.txt.tmp
|
|
|
|
fi
|
2024-10-30 01:20:16 +01:00
|
|
|
mv ~/plans.txt.tmp ~/sync/plans.txt
|
2024-10-30 01:16:16 +01:00
|
|
|
fi
|
2024-10-30 01:19:01 +01:00
|
|
|
if [ "$1" = "edit" ] ; then
|
|
|
|
hx ~/sync/plans.txt
|
|
|
|
fi
|
2024-10-31 17:39:26 +01:00
|
|
|
cat -n ~/sync/plans.txt
|
2024-10-30 01:16:16 +01:00
|
|
|
''
|
|
|
|
|