aboutsummaryrefslogtreecommitdiffstats
path: root/modules/home/soispha/conf/lf/commands/default.nix
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-20 16:06:57 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-05-20 16:14:24 +0200
commit5156e1aae36a153be98b6832ab3ced7be2b2faee (patch)
tree3f050d3bc567af4c72f87e0925d21c3521436e45 /modules/home/soispha/conf/lf/commands/default.nix
parentrefactor(hm/conf/zsh): Remove old zsh-prompt file (diff)
downloadnixos-config-5156e1aae36a153be98b6832ab3ced7be2b2faee.zip
refactor(hm): Rename to `modules/home`
Diffstat (limited to 'modules/home/soispha/conf/lf/commands/default.nix')
-rw-r--r--modules/home/soispha/conf/lf/commands/default.nix227
1 files changed, 227 insertions, 0 deletions
diff --git a/modules/home/soispha/conf/lf/commands/default.nix b/modules/home/soispha/conf/lf/commands/default.nix
new file mode 100644
index 00000000..933769ac
--- /dev/null
+++ b/modules/home/soispha/conf/lf/commands/default.nix
@@ -0,0 +1,227 @@
+{
+ pkgs,
+ sysLib,
+ shell_library,
+ system,
+ ...
+}: let
+ functionCall = {
+ name,
+ dependencies,
+ replacementStrings,
+ ...
+ }:
+ sysLib.writeShellScript {
+ inherit name;
+ src = ./scripts/${name}.sh;
+ keepPath = true;
+ dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash coreutils;});
+ inherit replacementStrings;
+ }
+ + "/bin/${name}";
+
+ shell = {
+ name,
+ dependencies,
+ replacementStrings ? null,
+ ...
+ }: ''
+ ''${{
+ ${functionCall {inherit name dependencies replacementStrings;}}
+ }}
+ ''; # closes the lf tui
+ pipe = {
+ name,
+ dependencies,
+ replacementStrings ? null,
+ ...
+ }: ''
+ %{{
+ ${functionCall {inherit name dependencies replacementStrings;}}
+ }}
+ ''; # runs the command in the ui/term bar
+ async = {
+ name,
+ dependencies,
+ replacementStrings ? null,
+ ...
+ }: ''
+ &{{
+ ${functionCall {inherit name dependencies replacementStrings;}}
+ }}
+ ''; # runs the command in the background
+ wait = {
+ name,
+ dependencies,
+ replacementStrings ? null,
+ ...
+ }: ''
+ !{{
+ ${functionCall {inherit name dependencies replacementStrings;}}
+ }}
+ ''; # adds a prompt after the command has run
+in {
+ archive = shell {
+ name = "archive";
+ dependencies = builtins.attrValues {
+ inherit
+ (pkgs)
+ fzf
+ gnutar
+ xz
+ p7zip
+ zip
+ ;
+ };
+ };
+ broot_jump = shell {
+ name = "broot_jump";
+ dependencies = builtins.attrValues {
+ inherit (pkgs) broot;
+ };
+ };
+ chmod = pipe {
+ name = "chmod";
+ dependencies = [];
+ };
+ clear_trash = shell {
+ name = "clear_trash";
+ dependencies = builtins.attrValues {
+ inherit
+ (pkgs)
+ fzf
+ trashy
+ ;
+ };
+ };
+ dl_file = pipe {
+ name = "dl_file";
+ dependencies = builtins.attrValues {
+ inherit
+ (pkgs)
+ xdragon
+ curl
+ ;
+ };
+ };
+ dragon = pipe {
+ name = "dragon";
+ dependencies = builtins.attrValues {
+ inherit
+ (pkgs)
+ xdragon
+ ;
+ };
+ };
+ dragon_individual = pipe {
+ name = "dragon_individual";
+ dependencies = builtins.attrValues {
+ inherit
+ (pkgs)
+ xdragon
+ ;
+ };
+ };
+ dragon_stay = pipe {
+ name = "dragon_stay";
+ dependencies = builtins.attrValues {
+ inherit
+ (pkgs)
+ xdragon
+ ;
+ };
+ };
+ execute = shell {
+ name = "execute";
+ dependencies = [];
+ };
+ follow_link = pipe {
+ name = "follow_link";
+ dependencies = with pkgs; [lf];
+ };
+ fzf_jump = shell {
+ name = "fzf_jump";
+ dependencies = builtins.attrValues {
+ inherit (pkgs) fzf lf gnused;
+ };
+ };
+ mk_dir = pipe {
+ name = "mk_dir";
+ dependencies = [];
+ };
+ mk_file = shell {
+ name = "mk_file";
+ dependencies = [];
+ };
+ mk_file_and_edit = shell {
+ name = "mk_file_and_edit";
+ dependencies = [];
+ };
+ mk_ln = pipe {
+ name = "mk_ln";
+ dependencies = [];
+ };
+ mk_scr_default = shell {
+ name = "mk_scr_default";
+ dependencies = builtins.attrValues {};
+ replacementStrings = {
+ SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}";
+ };
+ };
+ mk_scr_temp = shell {
+ name = "mk_scr_temp";
+ dependencies = builtins.attrValues {};
+ replacementStrings = {
+ SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}";
+ TO_BE_SHELL_LIBRARY_PATH = "%SHELL_LIBRARY_PATH"; # replacement is not recursive
+ };
+ };
+ view_file = async {
+ name = "view_file";
+ dependencies = builtins.attrValues {inherit (pkgs) file;};
+ };
+ go_project_base_directory = async {
+ name = "go_project_root";
+ dependencies = [];
+ };
+ restore_trash = shell {
+ name = "restore_trash";
+ dependencies = builtins.attrValues {
+ inherit
+ (pkgs)
+ fzf
+ trashy
+ ;
+ };
+ };
+ set_wall_paper = pipe {
+ name = "set_wall_paper";
+ dependencies = [];
+ };
+ stripspace = pipe {
+ name = "stripspace";
+ dependencies = [];
+ };
+ trash = pipe {
+ name = "trash";
+ dependencies = builtins.attrValues {
+ inherit
+ (pkgs)
+ trashy
+ trash-cli
+ findutils
+ ;
+ };
+ };
+ unarchive = pipe {
+ name = "unarchive";
+ dependencies = builtins.attrValues {
+ inherit
+ (pkgs)
+ gnutar
+ unzip
+ p7zip
+ ;
+ };
+ };
+}