fmt
This commit is contained in:
26
pkgs/repl/default.nix
Normal file
26
pkgs/repl/default.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
# yanked from @fufexan
|
||||
{
|
||||
coreutils,
|
||||
gnused,
|
||||
writeShellScriptBin,
|
||||
}:
|
||||
let
|
||||
repl = ../../lib/repl;
|
||||
example = command: desc: ''\n\u001b[33m ${command}\u001b[0m - ${desc}'';
|
||||
in
|
||||
writeShellScriptBin "repl" ''
|
||||
case "$1" in
|
||||
"-h"|"--help"|"help")
|
||||
printf "%b\n\e[4mUsage\e[0m: \
|
||||
${example "repl" "Loads system flake if available."} \
|
||||
${example "repl /path/to/flake.nix" "Loads specified flake."}\n"
|
||||
;;
|
||||
*)
|
||||
if [ -z "$1" ]; then
|
||||
nix repl ${repl}
|
||||
else
|
||||
nix repl --arg flakePath $(${coreutils}/bin/readlink -f $1 | ${gnused}/bin/sed 's|/flake.nix||') ${repl}
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
''
|
||||
Reference in New Issue
Block a user