Skip to content

Commit

Permalink
fix: better message about profile usage upon execution (#2391)
Browse files Browse the repository at this point in the history
### Description

<!--Add a description of your PR here-->

### QC
<!-- Make sure that you can tick the boxes below. -->

* [x] The PR contains a test case for the changes or the changes are
already covered by an existing test case.
* [x] The documentation (`docs/`) is updated to reflect the changes or
this is not necessary (e.g. if the change does neither modify the
language nor the behavior or functionalities of Snakemake).
  • Loading branch information
johanneskoester committed Aug 4, 2023
1 parent 7238458 commit cf8aea5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions snakemake/__init__.py
Expand Up @@ -1247,7 +1247,6 @@ def get_argument_parser(profiles=None):
Note that in such cases, the arguments may be given as nested YAML mappings
in the profile, e.g. 'set-threads: myrule: 4' instead of 'set-threads: myrule=4'.
""",
env_var="SNAKEMAKE_PROFILE",
)

group_exec.add_argument(
Expand Down Expand Up @@ -2758,6 +2757,7 @@ def main(argv=None):
if args.workflow_profile:
workflow_profile = args.workflow_profile
else:
# checking for default profile
default_path = Path("profiles/default")
workflow_profile_candidates = [
default_path,
Expand All @@ -2778,11 +2778,14 @@ def main(argv=None):
if args.profile:
profiles.append(args.profile)
if workflow_profile:
workflow_profile_stmt = f" and workflow specific profile {workflow_profile}"
profiles.append(workflow_profile)
else:
workflow_profile_stmt = ""

print(
f"Using profile{'s' if len(profiles) > 1 else ''} "
f"{' and '.join(map(str, profiles))} for setting default command line arguments.",
f"{' and '.join(map(str, profiles))}{workflow_profile_stmt} for setting default command line arguments.",
file=sys.stderr,
)

Expand Down

0 comments on commit cf8aea5

Please sign in to comment.