mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-06 08:46:54 +00:00
nushell: allow multi-word aliases
Also fix invalid alias in test
This commit is contained in:
parent
709aaab1a5
commit
82455a84e3
3 changed files with 11 additions and 5 deletions
|
@ -164,7 +164,10 @@ in {
|
||||||
shellAliases = lib.mkOption {
|
shellAliases = lib.mkOption {
|
||||||
type = types.attrsOf types.str;
|
type = types.attrsOf types.str;
|
||||||
default = { };
|
default = { };
|
||||||
example = { ll = "ls -l"; };
|
example = {
|
||||||
|
ll = "ls -l";
|
||||||
|
g = "git";
|
||||||
|
};
|
||||||
description = ''
|
description = ''
|
||||||
An attribute set that maps aliases (the top level attribute names in
|
An attribute set that maps aliases (the top level attribute names in
|
||||||
this option) to command strings or directly to build outputs.
|
this option) to command strings or directly to build outputs.
|
||||||
|
@ -202,7 +205,8 @@ in {
|
||||||
|| aliasesStr != "" || cfg.settings != { };
|
|| aliasesStr != "" || cfg.settings != { };
|
||||||
|
|
||||||
aliasesStr = lib.concatLines
|
aliasesStr = lib.concatLines
|
||||||
(lib.mapAttrsToList (k: v: "alias ${k} = ${v}") cfg.shellAliases);
|
(lib.mapAttrsToList (k: v: "alias ${toNushell { } k} = ${v}")
|
||||||
|
cfg.shellAliases);
|
||||||
in lib.mkIf writeConfig {
|
in lib.mkIf writeConfig {
|
||||||
"${configDir}/config.nu".text = lib.mkMerge [
|
"${configDir}/config.nu".text = lib.mkMerge [
|
||||||
(let
|
(let
|
||||||
|
|
|
@ -26,5 +26,6 @@ let config = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
alias ll = ls -a
|
alias "ll" = ls -a
|
||||||
alias lsname = (ls | get name)
|
alias "multi word alias" = cd -
|
||||||
|
alias "z" = __zoxide_z
|
||||||
|
|
|
@ -26,8 +26,9 @@
|
||||||
plugins = [ pkgs.nushellPlugins.formats ];
|
plugins = [ pkgs.nushellPlugins.formats ];
|
||||||
|
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
"lsname" = "(ls | get name)";
|
|
||||||
"ll" = "ls -a";
|
"ll" = "ls -a";
|
||||||
|
"multi word alias" = "cd -";
|
||||||
|
"z" = "__zoxide_z";
|
||||||
};
|
};
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue