mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-12 01:59:37 +08:00
bash: allow unsetting shell options
This commit is contained in:
committed by
Robert Helgesson
parent
039f786e60
commit
208e310e94
@@ -75,7 +75,14 @@ in
|
||||
# Warn if closing shell with running jobs.
|
||||
"checkjobs"
|
||||
];
|
||||
description = "Shell options to set.";
|
||||
example = [
|
||||
"extglob"
|
||||
"-cdspell"
|
||||
];
|
||||
description = ''
|
||||
Shell options to set. Prefix an option with
|
||||
<quote><literal>-</literal></quote> to unset.
|
||||
'';
|
||||
};
|
||||
|
||||
sessionVariables = mkOption {
|
||||
@@ -146,8 +153,10 @@ in
|
||||
mapAttrsToList (k: v: "alias ${k}=${escapeShellArg v}") cfg.shellAliases
|
||||
);
|
||||
|
||||
shoptsStr = concatStringsSep "\n" (
|
||||
map (v: "shopt -s ${v}") cfg.shellOptions
|
||||
shoptsStr = let
|
||||
switch = v: if hasPrefix "-" v then "-u" else "-s";
|
||||
in concatStringsSep "\n" (
|
||||
map (v: "shopt ${switch v} ${removePrefix "-" v}") cfg.shellOptions
|
||||
);
|
||||
|
||||
sessionVarsStr = config.lib.shell.exportAll cfg.sessionVariables;
|
||||
|
||||
Reference in New Issue
Block a user