Skip to content

projectBaseUrl parameter not parsed by commander #588

Description

@themadhatter37

Have you checked that the bug is not already fixed?

Yes

Summary

The input parameter --projectBaseUrl is ignored when running with commander 14.0.3.

Affected version

3.14.2

Steps to reproduce the bug

Create a configuration file (config.json) that includes the base URL, such as:

{
  "replacementPatterns": [
    {
      "pattern": "^/",
      "replacement": "{{BASEURL}}/"
    }
  ]
}

Then call markdown-link-check with the config file and with the projectBaseUrl parameter set:

markdown-link-check --projectBaseUrl=file:///path/to/project --config=config.json test.md

Expected behavior

Each link the markdown file beginning with / should be prepended with the path provided in projectBaseUrl.

Actual behavior

The projectBaseUrl is completely ignored, and instead the current working directory is used.

Additional context

I believe the issue stems from this line of code:

if (program.projectBaseUrl) {

Instead of program.projectBaseUrl, program.opts().projectBaseUrl should be used, as is done for all other options.
A breaking change was introduced in Commander 7.0.0 which required retrieving options via opts() - https://github.com/tj/commander.js/blob/master/CHANGELOG.md#700-2021-01-15

Can you fix it?

Yes

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugissue is a bug or pull request fixes a bugtriage

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions