Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken link in nf-core modules info #1745

Merged
merged 7 commits into from
Aug 18, 2022
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
- Add links in `README.md` for `info` and `patch` commands ([#1722](https://github.com/nf-core/tools/issues/1722)])
- Fix misc. issues with `--branch` and `--base-path` ([#1726](https://github.com/nf-core/tools/issues/1726))
- Add `branch` field to module entries in `modules.json` to record what branch a module was installed from ([#1728](https://github.com/nf-core/tools/issues/1728))
- Fix broken link in `nf-core modules info`([#1745](https://github.com/nf-core/tools/pull/1745))
- Fix unbound variable issues and minor refactoring [#1742](https://github.com/nf-core/tools/pull/1742/)

## [v2.4.1 - Cobolt Koala Patch](https://github.com/nf-core/tools/releases/tag/2.4) - [2022-05-16]
Expand Down
47 changes: 43 additions & 4 deletions nf_core/modules/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,46 @@


class ModuleInfo(ModuleCommand):
"""
Class to print information of a module.

Attributes
----------
meta : YAML object
stores the information from meta.yml file
local_path : str
path of the local modules
remote_location : str
remote repository URL
local : bool
indicates if the module is locally installed or not
repo_type : str
repository type. Can be either 'pipeline' or 'modules'
modules_json : ModulesJson object
contains 'modules.json' file information from a pipeline
module : str
name of the tool to get information from

Methods
-------
init_mod_name(module)
Makes sure that we have a module name
get_module_info()
Given the name of a module, parse meta.yml and print usage help
get_local_yaml()
Attempt to get the meta.yml file from a locally installed module
get_remote_yaml()
Attempt to get the meta.yml file from a remote repo
generate_module_info_help()
Take the parsed meta.yml and generate rich help
"""

def __init__(self, pipeline_dir, tool, remote_url, branch, no_pull, base_path):
super().__init__(pipeline_dir, remote_url, branch, no_pull, base_path)
self.meta = None
self.local_path = None
self.remote_location = None
self.local = None

# Quietly check if this is a pipeline or not
if pipeline_dir:
Expand All @@ -51,10 +86,10 @@ def init_mod_name(self, module):
module: str: Module name to check
"""
if module is None:
local = questionary.confirm(
self.local = questionary.confirm(
"Is the module locally installed?", style=nf_core.utils.nfcore_question_style
).unsafe_ask()
if local:
if self.local:
if self.repo_type == "modules":
modules = self.get_modules_clone_modules()
else:
Expand All @@ -78,7 +113,7 @@ def get_module_info(self):
"""Given the name of a module, parse meta.yml and print usage help."""

# Running with a local install, try to find the local meta
if self.dir:
if self.local:
self.meta = self.get_local_yaml()

# Either failed locally or in remote mode
Expand Down Expand Up @@ -163,7 +198,11 @@ def generate_module_info_help(self):
elif self.remote_location:
intro_text.append(
Text.from_markup(
f":globe_with_meridians: Repository: [link=https://github.com/{self.remote_location}]{self.remote_location}[/]\n"
":globe_with_meridians: Repository: "
f"{ '[link={self.remote_location}]' if self.remote_location.startswith('http') else ''}"
f"{self.remote_location}"
f"{'[/link]' if self.remote_location.startswith('http') else '' }"
"\n"
)
)

Expand Down