Skip to content

Commit

Permalink
refactor: use constant for menu command name
Browse files Browse the repository at this point in the history
  • Loading branch information
deemp committed Jan 13, 2024
1 parent 9c87676 commit 94add6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion modules/devshell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ let
# environment.
strOrPackage = import ../nix/strOrPackage.nix { inherit lib pkgs; };

inherit (import ../nix/commands/devshellMenu.nix { inherit pkgs; }) devshellMenuCommandName;

# Use this to define a flake app for the environment.
mkFlakeApp = bin: {
type = "app";
Expand Down Expand Up @@ -255,7 +257,7 @@ in
type = types.str;
default = ''
{202}🔨 Welcome to ${cfg.name}{reset}
$(type -p menu &>/dev/null && menu)
$(type -p ${devshellMenuCommandName} &>/dev/null && ${devshellMenuCommandName})
'';
apply = replaceStrings
(map (key: "{${key}}") (attrNames ansi))
Expand Down
3 changes: 2 additions & 1 deletion tests/core/commands.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ pkgs, devshell, runTest }:
let inherit (import ../../nix/commands/devshellMenu.nix { inherit pkgs; }) devshellMenuCommandName; in
{
# Basic devshell usage
commands-1 =
Expand Down Expand Up @@ -33,7 +34,7 @@
# Load the devshell
source ${shell}/env.bash
menu
${devshellMenuCommandName}
# Checks that all the commands are available
type -p bash-script
Expand Down

0 comments on commit 94add6b

Please sign in to comment.