Be reluctant to delete everything in destination

Sergey Astanin avatarSergey Astanin created an issue

Current obraz.py silently purges the entire destination directory, which is wrong as a misunderstood usage message or a typo may result in unlimited damage to the system.

The help message should make clear that:

  • --destination is supposed to be the root of the site itself
  • what is the default destination
  • obraz.py is about to purge everything in this directory (ALLCAPS please)

    -d --destination=DIR   Destination directory (default: ./_site) -- WILL BE PURGED!
    

The program should not act as a silent alias to rm -rf, and instead

  • may try to identify an existing site directory (by dropping there a special .dotfile, or checking if index.html and year-like subdirectories are present); if the destination doesn't appear to be a site directory, ask for confirmation
  • may always ask for confirmation if non-default destination is used, and implement --purge-destination option for the bravest

Comments (7)

  1. Sergey Astanin

    Well, fortunately, I don't use Jekyll. Unfortunately, this issue caused me to wipe the entire site source with new unpushed changes once. So I still believe that it's relevant.

    I'll prepare a pull request.

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.