diff --git a/src/virtualenv/activation/nushell/activate.nu b/src/virtualenv/activation/nushell/activate.nu index e9047ff5f..ffeff7d45 100644 --- a/src/virtualenv/activation/nushell/activate.nu +++ b/src/virtualenv/activation/nushell/activate.nu @@ -1,30 +1,30 @@ # This command prepares the required environment variables def-env activate-virtualenv [] { def is-string [x] { - ($x | describe) == "string" + ($x | describe) == 'string' } def has-env [name: string] { $name in (env).name } - let is-windows = ((sys).host.name | str downcase) == "windows" - let virtual-env = "__VIRTUAL_ENV__" - let bin = "__BIN_NAME__" - let path-sep = "__PATH_SEP__" + let is-windows = ((sys).host.name | str downcase) == 'windows' + let virtual-env = '__VIRTUAL_ENV__' + let bin = '__BIN_NAME__' + let path-sep = '__PATH_SEP__' let path-name = if $is-windows { - if (has-env "Path") { - "Path" + if (has-env 'Path') { + 'Path' } else { - "PATH" + 'PATH' } } else { - "PATH" + 'PATH' } let old-path = ( if $is-windows { - if (has-env "Path") { + if (has-env 'Path') { $env.Path } else { $env.PATH @@ -43,32 +43,32 @@ def-env activate-virtualenv [] { let new-path = ($old-path | prepend $venv-path | str collect $path-sep) # Creating the new prompt for the session - let virtual-prompt = if ("__VIRTUAL_PROMPT__" == "") { - $"(char lparen)($virtual-env | path basename)(char rparen) " + let virtual-prompt = if ('__VIRTUAL_PROMPT__' == '') { + $'(char lparen)($virtual-env | path basename)(char rparen) ' } else { - "(__VIRTUAL_PROMPT__) " + '(__VIRTUAL_PROMPT__) ' } # Back up the old prompt builder - let old-prompt-command = if (has-env "VIRTUAL_ENV") && (has-env "_OLD_PROMPT_COMMAND") { + let old-prompt-command = if (has-env 'VIRTUAL_ENV') && (has-env '_OLD_PROMPT_COMMAND') { $env._OLD_PROMPT_COMMAND } else { - if (has-env "PROMPT_COMMAND") { + if (has-env 'PROMPT_COMMAND') { $env.PROMPT_COMMAND } else { - "" + '' } } # If there is no default prompt, then only the env is printed in the prompt - let new-prompt = if (has-env "PROMPT_COMMAND") { - if ($old-prompt-command | describe) == "block" { - { $"($virtual-prompt)(do $old-prompt-command)" } + let new-prompt = if (has-env 'PROMPT_COMMAND') { + if ($old-prompt-command | describe) == 'block' { + { $'($virtual-prompt)(do $old-prompt-command)' } } else { - { $"($virtual-prompt)($old-prompt-command)" } + { $'($virtual-prompt)($old-prompt-command)' } } } else { - { $"($virtual-prompt)" } + { $'($virtual-prompt)' } } # Environment variables that will be batched loaded to the virtual env @@ -89,4 +89,4 @@ def-env activate-virtualenv [] { activate-virtualenv alias pydoc = python -m pydoc -alias deactivate = source "__DEACTIVATE_PATH__" +alias deactivate = source '__DEACTIVATE_PATH__' diff --git a/src/virtualenv/activation/nushell/deactivate.nu b/src/virtualenv/activation/nushell/deactivate.nu index 51b840bb2..904f7d0e8 100644 --- a/src/virtualenv/activation/nushell/deactivate.nu +++ b/src/virtualenv/activation/nushell/deactivate.nu @@ -3,16 +3,16 @@ def-env deactivate-virtualenv [] { $name in (env).name } - let is-windows = ((sys).host.name | str downcase) == "windows" + let is-windows = ((sys).host.name | str downcase) == 'windows' let path-name = if $is-windows { - if (has-env "Path") { - "Path" + if (has-env 'Path') { + 'Path' } else { - "PATH" + 'PATH' } } else { - "PATH" + 'PATH' } load-env { $path-name : $env._OLD_VIRTUAL_PATH }