File tree 2 files changed +19
-12
lines changed
2 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -1248,32 +1248,32 @@ namespace mamba
1248
1248
1249
1249
if (!env_transform.export_path .empty ())
1250
1250
{
1251
- out << " PATH = " << env_transform.export_path << (util::on_win ? ' ; ' : ' : ' ) ;
1251
+ out << " PATH = " << env_transform.export_path << " \n " ;
1252
1252
}
1253
1253
1254
1254
for (const fs::u8path& ds : env_transform.deactivate_scripts )
1255
1255
{
1256
- out << " source " << ds << " ; " ;
1256
+ out << " source " << ds << " \n " ;
1257
1257
}
1258
1258
1259
1259
for (const std::string& uvar : env_transform.unset_vars )
1260
1260
{
1261
- out << " hide-env " << uvar << " ; " ;
1261
+ out << " hide-env " << uvar << " \n " ;
1262
1262
}
1263
1263
1264
1264
for (const auto & [skey, svar] : env_transform.set_vars )
1265
1265
{
1266
- out << " let " << skey << " = " << svar << " ; " ;
1266
+ out << " let " << skey << " = " << svar << " \n " ;
1267
1267
}
1268
1268
1269
1269
for (const auto & [ekey, evar] : env_transform.export_vars )
1270
1270
{
1271
1271
// add unix or windows handling
1272
- out << ekey << " = " << evar << (util::on_win ? ' ; ' : ' : ' ) ;
1272
+ out << ekey << " = " << evar << " \n " ;
1273
1273
}
1274
1274
for (const fs::u8path& p : env_transform.activate_scripts )
1275
1275
{
1276
- out << " source " << p << " ; " ;
1276
+ out << " source " << p << " \n " ;
1277
1277
}
1278
1278
return out.str ();
1279
1279
}
Original file line number Diff line number Diff line change @@ -496,14 +496,21 @@ namespace mamba
496
496
}
497
497
#ask mamba how to setup the environment and set the environment
498
498
(^($env.MAMBA_EXE) shell activate --shell nu $name
499
+ | lines
499
500
| str replace --regex '\s+' '' --all
500
- | split row (if $nu.os-info.name == "windows" { ";" } else { ":" })
501
- | parse --regex '(.*)=(.+)'
502
- | transpose --header-row
503
- | into record
501
+ | parse --regex '([^=]+)=(.+)'
502
+ | reduce -f {} { |it, acc|
503
+ $acc | merge {
504
+ $it.capture0: (
505
+ if ($it.capture0 == "PATH") or ($it.capture0 | str ends-with "_PATH") {
506
+ $it.capture1 | split row (if $nu.os-info.name == "Windows" { ";" } else { ":" }) | where { |path| $path != "" }
507
+ } else {
508
+ $it.capture1
509
+ }
510
+ )
511
+ }
512
+ }
504
513
| load-env
505
- )
506
- $env.PATH = $env.PATH | split row (char esep)
507
514
# update prompt
508
515
if ($env.CONDA_PROMPT_MODIFIER? != null) {
509
516
$env.PROMPT_COMMAND = {|| $env.CONDA_PROMPT_MODIFIER + (do $env.PROMPT_COMMAND_BK)}
You can’t perform that action at this time.
0 commit comments