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 flag to override prompt for existing dir #1986

Merged
merged 3 commits into from
Sep 19, 2022
Merged

Conversation

Yaroslav-95
Copy link
Contributor

Added --force flag to build subcommand. This restores use-cases that PR #1558
broke, without breaking current default behaviour.

IMPORTANT: Please do not create a Pull Request adding a new feature without
discussing it first.

The place to discuss new features is the forum: https://zola.discourse.group/
If you want to add a new feature, please open a thread there first in the
feature requests section.

Sanity check:

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

Code changes (Delete or ignore this section for documentation changes)

  • Are you doing the PR on the next branch?

If the change is a new feature or adding to/changing an existing one:

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

Added --force flag to build subcommand.
@Keats
Copy link
Collaborator

Keats commented Sep 12, 2022

I think #1985 covers your usecase as it won't delete the folder?

@Yaroslav-95
Copy link
Contributor Author

Yaroslav-95 commented Sep 12, 2022 via email

src/cmd/build.rs Outdated
include_drafts: bool,
) -> Result<()> {
let mut site = Site::new(root_dir, config_file)?;
if let Some(output_dir) = output_dir {
// Check whether output directory exists or not
// This way we don't replace already existing files.
if output_dir.exists() {
if !force && output_dir.exists() {
console::warn(&format!("The directory '{}' already exists. Building to this directory will delete files contained within this directory.", output_dir.display()));

// Prompt the user to ask whether they want to continue.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's remove the tokio timeout + question if there is a flag option though. It should just fail if the folder exists and --force is not passed.

@Yaroslav-95
Copy link
Contributor Author

Yaroslav-95 commented Sep 14, 2022 via email

@Keats Keats merged commit c50ef1f into getzola:next Sep 19, 2022
@Keats
Copy link
Collaborator

Keats commented Sep 19, 2022

Thanks!

Keats pushed a commit that referenced this pull request Feb 16, 2023
* Add flag to override prompt for existing dir

Added --force flag to build subcommand.

* Remove unnecessary 'force' check

* Remove prompt to overwrite directory on build cmd
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