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

Add optional arg to serve for extra paths to watch for changes #2745

Merged
merged 2 commits into from
Dec 26, 2024

Conversation

rparrett
Copy link

@rparrett rparrett commented Dec 20, 2024

This PR implements a feature discussed in #2741.

Sanity check:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Code changes

  • Are you doing the PR on the next branch?

  • Have you created/updated the relevant documentation page(s)?

    There does seem to be some existing documentation related to the args for serve, but it is not comprehensive, and I suspect this isn't important enough to include there.

@rparrett rparrett changed the title Add optional arg to serve for extra paths to watch for changes Add optional arg to serve for extra paths to watch for changes Dec 21, 2024
Copy link
Collaborator

@Keats Keats left a comment

Choose a reason for hiding this comment

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

Just some nits


/// Extra path to watch for changes, relative to the project root.
#[clap(long)]
extra_watch_path: Vec<String>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should it be extra_watch_paths since it's a vec?

Copy link
Author

Choose a reason for hiding this comment

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

It's a vec, but the user would multiple paths by repeating the argument.

zola serve --extra_watch_path="a" --extra_watch_path="b"

So I think the singular makes the most sense. There's some precedent for this, e.g.

curl --header "Content-Type: application/json" --header "Authorization: Bearer token" https://api.example.com
grep --regexp="pattern1" --regexp="pattern2" file.txt

Happy to change it if you prefer though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's fine, I thought it was --extra_watch_paths=something,something_else with clap being smart enough to split on the ,

src/fs_utils.rs Outdated Show resolved Hide resolved
src/cmd/serve.rs Outdated Show resolved Hide resolved

/// Extra path to watch for changes, relative to the project root.
#[clap(long)]
extra_watch_path: Vec<String>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

That's fine, I thought it was --extra_watch_paths=something,something_else with clap being smart enough to split on the ,

@Keats Keats merged commit 0a43f61 into getzola:next Dec 26, 2024
5 checks passed
@rparrett
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants