Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Dist files
build
dist
*.egg-info

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Python
__pycache__/
*.pyc
12 changes: 3 additions & 9 deletions src/eessi/cli/check.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# license (SPDX): GPL-2.0-only
#
# authors: Kenneth Hoste (Ghent University)
# authors: Davide Grassano (CECAM-EPFL)

import os
import re
Expand All @@ -9,7 +10,7 @@
import typer
from rich import print as rich_print

from eessi.cli.help import help_callback
from eessi.cli import common_options as copts

app = typer.Typer()

Expand Down Expand Up @@ -265,14 +266,7 @@ def check_repo(repo: str):

@app.command()
def check(
help: bool = typer.Option(
None, # default value
"-h",
"--help",
help="Show this message and exit.",
callback=help_callback,
is_eager=True,
),
help: copts.HELP = None,
):
"""
Check CernVM-FS setup for accessing EESSI
Expand Down
26 changes: 26 additions & 0 deletions src/eessi/cli/common_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# license (SPDX): GPL-2.0-only
#
# authors: Kenneth Hoste (Ghent University)
# authors: Davide Grassano (CECAM-EPFL)

from typing import Annotated

import typer

from eessi.cli.help import help_callback, version_callback

HELP = Annotated[bool, typer.Option(
"-h",
"--help",
help="Show this message and exit aaaa.",
callback=help_callback,
is_eager=True,
)]

VERSION = Annotated[bool, typer.Option(
"-v",
"--version",
help="Show version of eessi CLI.",
callback=version_callback,
is_eager=True,
)]
12 changes: 3 additions & 9 deletions src/eessi/cli/init.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
# license (SPDX): GPL-2.0-only
#
# authors: Kenneth Hoste (Ghent University)
# authors: Davide Grassano (CECAM-EPFL)

import os
import sys

import typer

from eessi.cli.help import help_callback
from eessi.cli import common_options as copts

app = typer.Typer()


@app.command()
def init(
help: bool = typer.Option(
None, # default value
"-h",
"--help",
help="Show this message and exit.",
callback=help_callback,
is_eager=True,
),
help: copts.HELP = None,
):
"""
Initialize shell environment for using EESSI
Expand Down
21 changes: 4 additions & 17 deletions src/eessi/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
# authors:
# - Kenneth Hoste (Ghent University)
# - Alex Domingo (Vrije Universiteit Brussel)
# - Davide Grassano (CECAM-EPFL)

import typer

from eessi.cli import common_options as copts
from eessi.cli.check import app as check_app
from eessi.cli.help import help_callback, version_callback
from eessi.cli.init import app as init_app
from eessi.cli.shell import app as shell_app

Expand All @@ -26,22 +27,8 @@

@app.callback()
def main(
help: bool = typer.Option(
None, # default value
"-h",
"--help",
help="Show this message and exit.",
callback=help_callback,
is_eager=True,
),
version: bool = typer.Option(
None, # default value
"-v",
"--version",
help="Show version of eessi CLI.",
callback=version_callback,
is_eager=True,
),
help: copts.HELP = None,
version: copts.VERSION = None,
):
"""
Top level eessi command
Expand Down
11 changes: 2 additions & 9 deletions src/eessi/cli/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import typer
from rich import print as rich_print

from eessi.cli.help import help_callback
from eessi.cli import common_options as copts

app = typer.Typer()

Expand All @@ -27,14 +27,7 @@ def report_error(msg, exit_code: int = 1):

@app.command()
def shell(
help: bool = typer.Option(
None, # default value
"-h",
"--help",
help="Show this message and exit.",
callback=help_callback,
is_eager=True,
),
help: copts.HELP = None,
eessi_version: Annotated[str, typer.Option(
help="EESSI version"
)] = '',
Expand Down