summaryrefslogtreecommitdiff
path: root/lib/spack/spack/cmd/module.py
blob: c7735149ab774d2ac95ad5058551e41a9d9ac04d (plain) (blame)
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-2023 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 typing import Callable, Dict

import spack.cmd.modules.lmod
import spack.cmd.modules.tcl

description = "generate/manage module files"
section = "user environment"
level = "short"


_subcommands: Dict[str, Callable] = {}


def setup_parser(subparser):
    sp = subparser.add_subparsers(metavar="SUBCOMMAND", dest="module_command")
    spack.cmd.modules.lmod.add_command(sp, _subcommands)
    spack.cmd.modules.tcl.add_command(sp, _subcommands)


def module(parser, args):
    _subcommands[args.module_command](parser, args)