home/shell: restrict shells for cds
This commit is contained in:
@@ -370,26 +370,35 @@ in {
|
|||||||
# Code generated commands
|
# Code generated commands
|
||||||
|
|
||||||
"Generated" = {
|
"Generated" = {
|
||||||
"cds" = let
|
"cds" = lib.pipe (lib.range 1 9) [
|
||||||
inherit (lib.strings) concatStringsSep;
|
(map
|
||||||
inherit (extendedLib.strings) repeatString;
|
(n: {
|
||||||
|
realCommand = "cd " + (builtins.concatStringsSep "/" (lib.replicate n ".."));
|
||||||
inherit (lib.lists) range flatten replicate;
|
aliases = [
|
||||||
inherit (lib.attrsets) nameValuePair listToAttrs;
|
("cd" + (lib.strings.replicate (n + 1) "."))
|
||||||
|
|
||||||
nthCds = n: [
|
|
||||||
("cd" + (repeatString "." (n + 1)))
|
|
||||||
("cd." + toString n)
|
("cd." + toString n)
|
||||||
(repeatString "." (n + 1))
|
(lib.strings.replicate (n + 1) ".")
|
||||||
("." + toString n)
|
("." + toString n)
|
||||||
(".." + toString n)
|
(".." + toString n)
|
||||||
];
|
];
|
||||||
realCommand = n: "cd " + (concatStringsSep "/" (replicate n ".."));
|
})
|
||||||
|
)
|
||||||
nthCdsAsNameValuePairs = n: map (cmd: nameValuePair cmd (realCommand n)) (nthCds n);
|
(map
|
||||||
allCdNameValuePairs = flatten (map nthCdsAsNameValuePairs (range 1 9));
|
({ realCommand, aliases }: map (alias: {
|
||||||
in
|
name = alias;
|
||||||
listToAttrs allCdNameValuePairs;
|
value = {
|
||||||
|
alias = [ realCommand ];
|
||||||
|
shells = [
|
||||||
|
"bash"
|
||||||
|
"zsh"
|
||||||
|
"fish"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}) aliases)
|
||||||
|
)
|
||||||
|
builtins.concatLists
|
||||||
|
builtins.listToAttrs
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user