Skip to content

Conversation

@reakaleek
Copy link
Member

@reakaleek reakaleek commented Jan 30, 2025

Changes

Add mv command to docs-builder CLI.

Results

docs-builder mv ./docs/migration/ia.md ./docs/new-folder/ia.md

image

docs-builder mv --help

Usage: mv [arguments...] [options...] [-h|--help] [--version]

Move a file or folder from one location to another and update all links in the documentation

Arguments:
  [0] <string?>    The source file or folder path to move from
  [1] <string?>    The target file or folder path to move to

Options:
  --dry-run <bool?>      Dry run the move operation (Default: null)
  -p|--path <string?>    Defaults to the`{pwd}` folder (Default: null)

docs-builder mv ./docs/migration/ia.md ./docs/new-folder/ia.md && git status

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        deleted:    docs/migration/ia.md
        modified:   docs/migration/index.md

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        docs/new-folder/

Limitations

  • Currently, it can only move single files not folder
  • The docset.yml and toc.yml files are not updated. However, you will get an error while building.

return true;
}

private async Task ProcessMarkdownFile(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping that we could leverage markdig here.

E.g we parse the document AST and include a linkrewriter parser (or make it part of our existing DiagnosticLinksParser. To mutate the links.

Then we can write the AST back out again as markdown.

markdig supports roundtipping like this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes totally sense.

Given the time and the need for it already today/tomorrow, do you think we can leave it this way for now and refactor it in a follow-up using Markdig?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100%! progress over perfection.

@reakaleek reakaleek self-assigned this Jan 30, 2025
@reakaleek reakaleek requested review from a team and Mpdreamz January 30, 2025 13:41
@reakaleek reakaleek marked this pull request as ready for review January 30, 2025 13:41
@reakaleek reakaleek changed the title Add mv command Add docs-builder mv command Jan 30, 2025
Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@reakaleek reakaleek merged commit b51d311 into main Jan 30, 2025
5 checks passed
@reakaleek reakaleek deleted the feature/mv-command branch January 30, 2025 15:20
@bmorelli25 bmorelli25 mentioned this pull request Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants