Better shell completion support for packages (#44756)

This commit is contained in:
Alec Scott
2024-09-27 16:02:37 -07:00
committed by GitHub
parent 07e964c688
commit 5c8d22c597
7 changed files with 120 additions and 1 deletions

View File

@@ -99,6 +99,7 @@
install_dependency_symlinks,
on_package_attributes,
)
from spack.package_completions import *
from spack.spec import InvalidSpecDetected, Spec
from spack.util.executable import *
from spack.util.filesystem import file_command, fix_darwin_install_name, mime_type

View File

@@ -0,0 +1,48 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from pathlib import Path
from typing import Union
"""Functions relating to shell autocompletion scripts for packages."""
def bash_completion_path(root: Union[str, Path]) -> Path:
"""
Return standard path for bash completion scripts under root.
Args:
root: The prefix root under which to generate the path.
Returns:
Standard path for bash completion scripts under root.
"""
return Path(root) / "share" / "bash-completion" / "completions"
def zsh_completion_path(root: Union[str, Path]) -> Path:
"""
Return standard path for zsh completion scripts under root.
Args:
root: The prefix root under which to generate the path.
Returns:
Standard path for zsh completion scripts under root.
"""
return Path(root) / "share" / "zsh" / "site-functions"
def fish_completion_path(root: Union[str, Path]) -> Path:
"""
Return standard path for fish completion scripts under root.
Args:
root: The prefix root under which to generate the path.
Returns:
Standard path for fish completion scripts under root.
"""
return Path(root) / "share" / "fish" / "vendor_completions.d"