Skip to content

app

check()

Compare settings to system defaults

Source code in hpcman/hpcman/user/app.py
@app.command()
def check() -> None:
    """
    Compare settings to system defaults
    """
    raise CommandNotImplemented("check command has not been implemented.")

enable(config=get_default_config_path(), verbose=0)

Enable configuration of environment variables using hpcman

Source code in hpcman/hpcman/user/app.py
@app.command()
def enable(
    config: Annotated[Path, typer.Argument(help="Path to config location.")] = get_default_config_path(),
    verbose: Annotated[
        int,
        typer.Option(
            "-v",
            "--verbose",
            count=True,
            help="Increase verbosity. Can specify more than once.",
            show_default=False,
            metavar="",
        ),
    ] = 0,
) -> None:
    """
    Enable configuration of environment variables using hpcman
    """
    global logger
    logger = init_logger(logger, verbosity=verbose)
    from .dotenv import setup_envfile
    setup_envfile(config)

info()

Get configuration info for user

Source code in hpcman/hpcman/user/app.py
@app.command()
def info() -> None:
    """
    Get configuration info for user
    """
    raise CommandNotImplemented("info command has not been implemented.")

quota()

Check user disk quota

Source code in hpcman/hpcman/user/app.py
@app.command()
def quota() -> None:
    """
    Check user disk quota
    """
    raise CommandNotImplemented("quota command has not been implemented.")

setup(setuptype, cpuarch=CPUArch(platform.machine()), envfile=Path(environ[VARENVFILE]) if VARENVFILE in environ else None, optionalpath=None, verbose=0)

Setup specific software and/or other settings.

Source code in hpcman/hpcman/user/app.py
@app.command(no_args_is_help=True, epilog="\n\n".join(setup_examples))
def setup(
    setuptype: Annotated[
        SetupType,
        typer.Argument(
            help="Choose a type of software/setting to setup.",
            show_choices=True,
            show_default=False,
        ),
    ],
    cpuarch: Annotated[
        CPUArch,
        typer.Option(
            "--arch",
            help="CPU Architecture to target for setup.",
            show_default=f"Current machine '{platform.node()}' CPU arch",
        ),
    ] = CPUArch(platform.machine()),
    envfile: Annotated[
        Union[Path, None],
        typer.Option(
            "-e",
            "--envfile",
            help="Envfile to set vars to.",
            hidden=True,
        ),
    ] = Path(environ[VARENVFILE]) if VARENVFILE in environ else None,
    optionalpath: Annotated[
        Union[Path, None],
        typer.Argument(
            help="Path to set so you have tab completion for paths.", show_default=False, hidden=True, metavar="[DIR]"
        ),
    ] = None,
    verbose: Annotated[
        int,
        typer.Option(
            "-v",
            "--verbose",
            count=True,
            help="Increase verbosity. Can specify more than once.",
            show_default=False,
            metavar="",
        ),
    ] = 0,
) -> None:
    """
    Setup specific software and/or other settings.
    """
    global logger
    logger = init_logger(logger, verbosity=verbose)
    if envfile is None:
        envfile_error()
    from .dotenv import run_setup
    logger.trace(f"run_setup({setuptype.value}, {optionalpath})")
    run_setup(setuptype, optionalpath, cpuarch=cpuarch)

setvar()

Set configuration info for user

Source code in hpcman/hpcman/user/app.py
@app.command()
def setvar() -> None:
    """
    Set configuration info for user
    """
    raise CommandNotImplemented("setvar command has not been implemented.")

ssh()

Check sshkey setup and provide help

Source code in hpcman/hpcman/user/app.py
@app.command()
def ssh() -> None:
    """
    Check sshkey setup and provide help
    """
    raise CommandNotImplemented("ssh command has not been implemented.")

update_dotfiles(etcpath=Path(BASEETCDIR), oldetc=OLDETC, configs=None, verbose=1, quiet=0)

Update dotfile paths to the latest version.

Source code in hpcman/hpcman/user/app.py
@app.command(no_args_is_help=True)
def update_dotfiles(
    etcpath: Annotated[Path, typer.Argument(help="Path to dotfile directory.", exists=True)] = Path(BASEETCDIR),
    oldetc: Annotated[
        str,
        typer.Option(
            help="Old etc path to replace.",
        ),
    ] = OLDETC,
    configs: Annotated[
        Union[List[ConfigFiles], None],
        typer.Option(
            "-c",
            "--config",
            show_choices=True,
            help="Choose dotfiles to update.",
        ),
    ] = None,
    verbose: Annotated[
        int,
        typer.Option(
            "-v",
            "--verbose",
            count=True,
            max=6,
            clamp=True,
            help="Increase verbosity. Can specify more than once.",
            show_default=False,
            metavar="",
        ),
    ] = 1,
    quiet: Annotated[
        int,
        typer.Option(
            "-q",
            "--quiet",
            count=True,
            max=9,
            clamp=True,
            help="Decrease verbosity. Can specify more than once.",
            show_default=False,
            metavar="",
        ),
    ] = 0,
) -> None:
    """
    Update dotfile paths to the latest version.
    """
    global logger
    logger = init_logger(logger, verbosity=verbose - quiet)

    if configs is None:
        logger.error("Please provide at least one config type to update.")
        exit(1)

    if ConfigFiles.ALL in configs:
        configs = [ConfigFiles.BASHRC, ConfigFiles.CSHRC, ConfigFiles.ZSHRC]

    from .dotenv import backup_and_update_dotfiles
    backup_and_update_dotfiles(etcpath, oldetc, configs)

user()

Get and/or set user env variables, preferred program versions, and quota

Source code in hpcman/hpcman/user/app.py
@app.callback()
def user() -> None:
    """
    Get and/or set user env variables, preferred program versions, and quota
    """