From ca872f9c34f6b360d9d67a91294fa66452867e78 Mon Sep 17 00:00:00 2001 From: "John W. Parent" <45471568+johnwparent@users.noreply.github.com> Date: Fri, 1 Sep 2023 14:36:27 -0400 Subject: Windows: fix pwsh env activate/deactivate; load/unload (#39118) These commands are currently broken on powershell (Windows) due to improper use of the InvokeCommand commandlet and a lack of direct support for the `--pwsh` argument in `spack load`, `spack unload`, and `spack env deactivate`. --- share/spack/spack-completion.bash | 6 +++--- share/spack/spack-completion.fish | 12 +++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'share') diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index 63e1aa6d5c..d41b540a0e 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -1012,7 +1012,7 @@ _spack_env_activate() { } _spack_env_deactivate() { - SPACK_COMPREPLY="-h --help --sh --csh --fish --bat" + SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --pwsh" } _spack_env_create() { @@ -1304,7 +1304,7 @@ _spack_list() { _spack_load() { if $list_options then - SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --first --only --list" + SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --pwsh --first --only --list" else _installed_packages fi @@ -1922,7 +1922,7 @@ _spack_unit_test() { _spack_unload() { if $list_options then - SPACK_COMPREPLY="-h --help --sh --csh --fish --bat -a --all" + SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --pwsh -a --all" else _installed_packages fi diff --git a/share/spack/spack-completion.fish b/share/spack/spack-completion.fish index 967ec96207..c4b9d47871 100755 --- a/share/spack/spack-completion.fish +++ b/share/spack/spack-completion.fish @@ -1442,7 +1442,7 @@ complete -c spack -n '__fish_spack_using_command env activate' -s d -l dir -r -f complete -c spack -n '__fish_spack_using_command env activate' -s d -l dir -r -d 'activate the environment in this directory' # spack env deactivate -set -g __fish_spack_optspecs_spack_env_deactivate h/help sh csh fish bat +set -g __fish_spack_optspecs_spack_env_deactivate h/help sh csh fish bat pwsh complete -c spack -n '__fish_spack_using_command env deactivate' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command env deactivate' -s h -l help -d 'show this help message and exit' complete -c spack -n '__fish_spack_using_command env deactivate' -l sh -f -a shell @@ -1453,6 +1453,8 @@ complete -c spack -n '__fish_spack_using_command env deactivate' -l fish -f -a s complete -c spack -n '__fish_spack_using_command env deactivate' -l fish -d 'print fish commands to activate the environment' complete -c spack -n '__fish_spack_using_command env deactivate' -l bat -f -a shell complete -c spack -n '__fish_spack_using_command env deactivate' -l bat -d 'print bat commands to activate the environment' +complete -c spack -n '__fish_spack_using_command env deactivate' -l pwsh -f -a shell +complete -c spack -n '__fish_spack_using_command env deactivate' -l pwsh -d 'print pwsh commands to activate the environment' # spack env create set -g __fish_spack_optspecs_spack_env_create h/help d/dir keep-relative without-view with-view= @@ -1972,7 +1974,7 @@ complete -c spack -n '__fish_spack_using_command list' -l update -r -f -a update complete -c spack -n '__fish_spack_using_command list' -l update -r -d 'write output to the specified file, if any package is newer' # spack load -set -g __fish_spack_optspecs_spack_load h/help sh csh fish bat first only= list +set -g __fish_spack_optspecs_spack_load h/help sh csh fish bat pwsh first only= list complete -c spack -n '__fish_spack_using_command_pos_remainder 0 load' -f -a '(__fish_spack_installed_specs)' complete -c spack -n '__fish_spack_using_command load' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command load' -s h -l help -d 'show this help message and exit' @@ -1984,6 +1986,8 @@ complete -c spack -n '__fish_spack_using_command load' -l fish -f -a shell complete -c spack -n '__fish_spack_using_command load' -l fish -d 'print fish commands to load the package' complete -c spack -n '__fish_spack_using_command load' -l bat -f -a shell complete -c spack -n '__fish_spack_using_command load' -l bat -d 'print bat commands to load the package' +complete -c spack -n '__fish_spack_using_command load' -l pwsh -f -a shell +complete -c spack -n '__fish_spack_using_command load' -l pwsh -d 'print pwsh commands to load the package' complete -c spack -n '__fish_spack_using_command load' -l first -f -a load_first complete -c spack -n '__fish_spack_using_command load' -l first -d 'load the first match if multiple packages match the spec' complete -c spack -n '__fish_spack_using_command load' -l only -r -f -a 'package dependencies' @@ -2845,7 +2849,7 @@ complete -c spack -n '__fish_spack_using_command unit-test' -l showlocals -f -a complete -c spack -n '__fish_spack_using_command unit-test' -l showlocals -d 'show local variable values in tracebacks' # spack unload -set -g __fish_spack_optspecs_spack_unload h/help sh csh fish bat a/all +set -g __fish_spack_optspecs_spack_unload h/help sh csh fish bat pwsh a/all complete -c spack -n '__fish_spack_using_command_pos_remainder 0 unload' -f -a '(__fish_spack_installed_specs)' complete -c spack -n '__fish_spack_using_command unload' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command unload' -s h -l help -d 'show this help message and exit' @@ -2857,6 +2861,8 @@ complete -c spack -n '__fish_spack_using_command unload' -l fish -f -a shell complete -c spack -n '__fish_spack_using_command unload' -l fish -d 'print fish commands to load the package' complete -c spack -n '__fish_spack_using_command unload' -l bat -f -a shell complete -c spack -n '__fish_spack_using_command unload' -l bat -d 'print bat commands to load the package' +complete -c spack -n '__fish_spack_using_command unload' -l pwsh -f -a shell +complete -c spack -n '__fish_spack_using_command unload' -l pwsh -d 'print pwsh commands to load the package' complete -c spack -n '__fish_spack_using_command unload' -s a -l all -f -a all complete -c spack -n '__fish_spack_using_command unload' -s a -l all -d 'unload all loaded Spack packages' -- cgit v1.2.3-70-g09d2