Skip to content

Commit

Permalink
fix pineko help
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomomagni committed Mar 8, 2024
1 parent 3365f2e commit 2c755c6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/pineko/cli/_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Adds global CLI options."""

import pathlib
import sys

import click

Expand All @@ -9,6 +10,11 @@
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])


def help_requested():
"""Check if you are requesting help."""
return len(set(CONTEXT_SETTINGS["help_option_names"]) & set(sys.argv)) > 0


@click.group(context_settings=CONTEXT_SETTINGS)
def command():
"""pineko: Combine PineAPPL grids and EKOs into FK tables."""
Expand All @@ -26,6 +32,9 @@ def command():

def load_config(cfg):
"""Load configuration files."""
# if just help is needed, return before loading
if help_requested():
return
path = configs.detect(cfg)
base_configs = configs.load(path)
configs.configs = configs.defaults(base_configs)
Expand Down

0 comments on commit 2c755c6

Please sign in to comment.