aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-03-31 16:51:29 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-03-31 16:55:55 +0200
commit9ad692088510b92c84a6c06c4bba30ebb7aa8e9c (patch)
tree8eecbb649c54626617adecc93aeabefe8a83223b
parentfix(modules/lf/commands/dragon-*): Use new `dragon-drop` name (diff)
downloadnixos-config-9ad692088510b92c84a6c06c4bba30ebb7aa8e9c.zip
fix(modules/lf/commands): Avoid inheriting the path by default
All the commands should have their respective dependencies set. The ones that need external commands (i.e., `execute`) can opt into keeping their path set.
-rw-r--r--modules/by-name/lf/lf/commands/default.nix38
1 files changed, 13 insertions, 25 deletions
diff --git a/modules/by-name/lf/lf/commands/default.nix b/modules/by-name/lf/lf/commands/default.nix
index 42508566..aa78514f 100644
--- a/modules/by-name/lf/lf/commands/default.nix
+++ b/modules/by-name/lf/lf/commands/default.nix
@@ -2,53 +2,38 @@
functionCall = {
name,
dependencies,
- ...
+ keepPath ? false,
}:
pkgs.writeShellApplication {
inherit name;
text = builtins.readFile ./base.sh + builtins.readFile ./scripts/${name}.sh;
runtimeInputs = dependencies;
+ inheritPath = keepPath;
}
+ "/bin/${name}";
# closes the lf tui
- shell = {
- name,
- dependencies,
- ...
- }: ''
+ shell = args: ''
''${{
- ${functionCall {inherit name dependencies;}}
+ ${functionCall args}
}}
'';
# runs the command in the ui/term bar
- pipe = {
- name,
- dependencies,
- ...
- }: ''
+ pipe = args: ''
%{{
- ${functionCall {inherit name dependencies;}}
+ ${functionCall args}
}}
'';
# runs the command in the background
- async = {
- name,
- dependencies,
- ...
- }: ''
+ async = args: ''
&{{
- ${functionCall {inherit name dependencies;}}
+ ${functionCall args}
}}
'';
# adds a prompt after the command has run
- wait = {
- name,
- dependencies,
- ...
- }: ''
+ wait = args: ''
!{{
- ${functionCall {inherit name dependencies;}}
+ ${functionCall args}
}}
'';
in {
@@ -97,6 +82,7 @@ in {
execute = shell {
name = "execute";
dependencies = [];
+ keepPath = true;
};
follow_link = pipe {
name = "follow_link";
@@ -118,6 +104,7 @@ in {
mk_script = shell {
name = "mk_script";
dependencies = [];
+ keepPath = true;
};
set_clipboard_path = async {
@@ -153,5 +140,6 @@ in {
view_file = async {
name = "view_file";
dependencies = with pkgs; [file];
+ keepPath = true;
};
}