forked from spack/spack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcd.py
More file actions
26 lines (20 loc) · 800 Bytes
/
cd.py
File metadata and controls
26 lines (20 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright 2013-2022 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)
import spack.cmd.common
import spack.cmd.location
description = "cd to spack directories in the shell"
section = "developer"
level = "long"
def setup_parser(subparser):
"""This is for decoration -- spack cd is used through spack's
shell support. This allows spack cd to print a descriptive
help message when called with -h."""
spack.cmd.location.setup_parser(subparser)
def cd(parser, args):
spec = " ".join(args.spec) if args.spec else "SPEC"
spack.cmd.common.shell_init_instructions(
"spack cd",
"cd `spack location --install-dir %s`" % spec
)