mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
zsh: escape named directory hashes
Named directory hash values are rendered into zsh code. Interpolating them inside double quotes is not enough for values containing quotes, glob syntax, or other shell metacharacters. Render both the hash name and target with shell escaping so dirHashes entries are emitted as literal zsh arguments.
This commit is contained in:
@@ -8,6 +8,12 @@
|
||||
"/tmp/with space"
|
||||
"/tmp/with[glob]"
|
||||
];
|
||||
dirHashes = {
|
||||
docs = "/tmp/with space";
|
||||
glob = "/tmp/with[glob]";
|
||||
home = "$HOME/Documents";
|
||||
quoted = ''/tmp/with "quotes"'';
|
||||
};
|
||||
|
||||
initContent = lib.mkMerge [
|
||||
(lib.mkBefore ''
|
||||
@@ -71,6 +77,12 @@
|
||||
# Default priority
|
||||
echo "Default priority content"
|
||||
|
||||
# Named Directory Hashes
|
||||
hash -d docs="/tmp/with space"
|
||||
hash -d glob="/tmp/with[glob]"
|
||||
hash -d home="$HOME/Documents"
|
||||
hash -d quoted="/tmp/with \"quotes\""
|
||||
|
||||
zprof
|
||||
# Low priority (mkAfter)
|
||||
echo "Low priority content"
|
||||
|
||||
Reference in New Issue
Block a user