-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3cc923
commit a76cc6e
Showing
10 changed files
with
43 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env nu | ||
def-env "micromamba activate" [name: string] { | ||
# get envs and update current env to path | ||
let envs = ( | ||
(micromamba env list --json | from json).envs | reduce -f {} {|it, acc| | ||
$acc | upsert ($it | path basename) $it | ||
} | ||
) | ||
|
||
# fetch path of current environment and update if present | ||
let env_path = ($envs | get $name) | ||
let p = ([$env_path "bin"] | path join) | ||
if not $p in $env.PATH { | ||
$env.PATH = ($env.PATH | prepend $p) | ||
$env.MICROMAMBA_CURRENT_ENV = $name | ||
} | ||
} | ||
|
||
def-env "micromamba deactivate" [] { | ||
# get envs and unset current env | ||
let envs = ( | ||
(micromamba env list --json | from json).envs | reduce -f {} {|it, acc| | ||
$acc | upsert ($it | path basename) $it | ||
} | ||
) | ||
if $env.MICROMAMBA_CURRENT_ENV in $envs { | ||
let path = ([($envs | get $env.MICROMAMBA_CURRENT_ENV) "bin"] | path join) | ||
$env.PATH = ($env.PATH | filter {|it| $it != $path}) | ||
$env.MICROMAMBA_CURRENT_ENV = "" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters