Refactor todos-add, remove todos-edit
This commit is contained in:
parent
1574605360
commit
7780eca7a9
9 changed files with 22 additions and 66 deletions
|
@ -10,6 +10,7 @@
|
|||
"move-firefox-screenshots"
|
||||
"setbg"
|
||||
"tag-release"
|
||||
"todos-add"
|
||||
"unmounter"
|
||||
"update-all-git-repos"
|
||||
];
|
||||
|
|
21
modules/home-manager/cli/scripts/todos-add.nix
Executable file
21
modules/home-manager/cli/scripts/todos-add.nix
Executable file
|
@ -0,0 +1,21 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "todos-add";
|
||||
|
||||
runtimeInputs = with pkgs; [ coreutils ];
|
||||
|
||||
text = ''
|
||||
TODOS_PATH="$HOME/Documents/wiki/todo.txt"
|
||||
|
||||
if [ ''${#} -eq 0 ]; then
|
||||
if [ -p "/dev/stdin" ]; then
|
||||
(cat; printf "\n\n") >> "''${TODOS_PATH}"
|
||||
else
|
||||
eval "''${TODOS_EDITOR}" "''${TODOS_PATH}"
|
||||
fi
|
||||
else
|
||||
printf "%s\n\n" "''${*}" >> "''${TODOS_PATH}"
|
||||
fi
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue