Refactor todos-add, remove todos-edit
This commit is contained in:
parent
1574605360
commit
7780eca7a9
9 changed files with 22 additions and 66 deletions
|
@ -28,7 +28,6 @@
|
|||
"${userDirs.documents}:1"
|
||||
];
|
||||
|
||||
todos.enable = true;
|
||||
zsh.enable = true;
|
||||
};
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
"${userDirs.documents}:1"
|
||||
];
|
||||
|
||||
todos.enable = true;
|
||||
zsh.enable = true;
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
'';
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
name = "todos";
|
||||
cfg = config.features.cli.${name};
|
||||
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
{
|
||||
options.features.cli.${name} = {
|
||||
enable = lib.mkEnableOption "Enable ${name}";
|
||||
|
||||
directory = mkOption {
|
||||
default = "${config.xdg.userDirs.documents}/todos";
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
todos-add
|
||||
todos-edit
|
||||
];
|
||||
|
||||
sessionVariables = {
|
||||
TODOS_DIRECTORY = cfg.directory;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -14,7 +14,6 @@
|
|||
./cli/sxhkd.nix
|
||||
./cli/tmux-sessionizer.nix
|
||||
./cli/tmux.nix
|
||||
./cli/todos.nix
|
||||
./cli/zsh
|
||||
./coding/neovim
|
||||
./coding/phpactor
|
||||
|
|
|
@ -12,8 +12,6 @@ in
|
|||
displayselect = callPackage ./displayselect { };
|
||||
notes = callPackage ./notes { };
|
||||
passmenu-otp = callPackage ./passmenu-otp.nix { };
|
||||
todos-add = callPackage ./todos/todos-add.nix { };
|
||||
todos-edit = callPackage ./todos/todos-edit.nix { };
|
||||
tmux-sessionizer = callPackage ./tmux-sessionizer { };
|
||||
upload-to-files = callPackage ./upload-to-files.nix { };
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "todos-add";
|
||||
|
||||
text = ''
|
||||
TODOS_DIRECTORY="''${TODOS_DIRECTORY:-"$XDG_DOCUMENTS_DIR/todos"}"
|
||||
export TODOS_DIRECTORY
|
||||
|
||||
echo "$*" >> "$TODOS_DIRECTORY/$(date +%Y-%m-%d).txt"
|
||||
'';
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "todos-edit";
|
||||
|
||||
text = ''
|
||||
TODOS_DIRECTORY="''${TODOS_DIRECTORY:-"$XDG_DOCUMENTS_DIR/todos"}"
|
||||
export TODOS_DIRECTORY
|
||||
|
||||
"$EDITOR" "$TODOS_DIRECTORY/$(date +%Y-%m-%d).txt";
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue