about summary refs log tree commit diff stats
path: root/pkgs/by-name/lm
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-21 17:29:54 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-21 17:29:54 +0200
commit3a0713ce08f14525e1cb5e645cf411a07d6ccb19 (patch)
treeb953aae4c21faeefe6399ec6e9b65b7554f9dac1 /pkgs/by-name/lm
parentfix(pkgs/iamb): Temporarily include as pkg (diff)
downloadnixos-config-3a0713ce08f14525e1cb5e645cf411a07d6ccb19.zip
fix(pkgs/ll): Ensure that the last_directory save dir exists
Diffstat (limited to 'pkgs/by-name/lm')
-rwxr-xr-xpkgs/by-name/lm/lm/lm.sh12
-rw-r--r--pkgs/by-name/lm/lm/package.nix9
2 files changed, 21 insertions, 0 deletions
diff --git a/pkgs/by-name/lm/lm/lm.sh b/pkgs/by-name/lm/lm/lm.sh
new file mode 100755
index 00000000..d5fdca10
--- /dev/null
+++ b/pkgs/by-name/lm/lm/lm.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env dash
+
+# shellcheck source=/dev/null
+SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+
+if [ -f "$XDG_RUNTIME_DIR/ll/last_directory" ]; then
+    last_dir="$(cat "$XDG_RUNTIME_DIR/ll/last_directory")"
+    cd "$last_dir" || die "$last_dir does not exist!"
+else
+    msg "No last directory saved (try using ll instead)."
+fi
+# vim: ft=sh
diff --git a/pkgs/by-name/lm/lm/package.nix b/pkgs/by-name/lm/lm/package.nix
new file mode 100644
index 00000000..ef417cd2
--- /dev/null
+++ b/pkgs/by-name/lm/lm/package.nix
@@ -0,0 +1,9 @@
+{sysLib}:
+sysLib.writeShellScript {
+  name = "lm";
+  src = ./lm.sh;
+  generateCompletions = false;
+
+  # `ll` must be able to change the path of the running shell.
+  wrap = false;
+}