TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
8k stars 1.18k forks source link

Commands that write files should output the pathnames #1017

Open Jermolene opened 9 years ago

Jermolene commented 9 years ago

In --verbose mode, the --savetiddler, --rendertiddler and --rendertiddlers commands should output the paths to the files that they create:

$ tiddlywiki editions/tw5.com --verbose --build index
Boot log:
  Startup task: load-modules
  Startup task: info after: load-modules before: startup
  Startup task: startup after: load-modules
  Startup task: story after: startup
  Startup task: commands platforms: node after: story
Executing command: build index
Executing command: savetiddlers [tag[external-image]] images
Writing file: editions/tw5.com/output/images/Motovun%20Jack.jpg
Writing file: editions/tw5.com/output/images/Motovun%20Jack.svg
Executing command: setfield [tag[external-image]] _canonical_uri $:/core/templates/canonical-uri-external-image text/plain
Executing command: setfield [tag[external-image]] text  text/plain
Executing command: rendertiddler $:/core/save/all index.html text/plain
Writing file: editions/tw5.com/output/index.html
$
pmario commented 9 years ago

IMO --rendertiddlers also deletes the target directory. ... So please make sure, that it's impossible to delete rootfolder or delete folder with valuable content by accident.

Jermolene commented 9 years ago

I can see how we could detect and prevent attempts to delete the root directory (at least on Unix-like systems), but how could we do a better job of avoiding deleting valuable content?

pmario commented 9 years ago

but how could we do a better job of avoiding deleting valuable content?

I'm not really sure. I was thinking about a "non empty" warning. ... But eg: "static" will not be empty, that's why we need to delete it :) So the answer there would be always "yes .. delete"

May be a user intervention needed, if --output parameter points to a higher directory, than the current working directory.

The reason why I found out, that some warnings may be useful is this:

I knew, that --rendertiddlers will delete the output folder. I just couldn't remember anymore. .... So if --rendertiddlers is used from the command line, I personally would always want some feedback.

If --rendertiddlers is used from tiddlywiki.info file, there should be an option to switch feedback off.

Jermolene commented 9 years ago

Hi @pmario

The safest behaviour would maybe be for rendertiddlers to complain if the output directly isn't empty. So users would need to delete the old files before running rendertiddlers.

But I'm not keen on that because it means that there is a platform specific step that can't be performed by the --build command.

May be a user intervention needed, if --output parameter points to a higher directory, than the current working directory.

Well, one might have the current directory inside output/static because one is inspecting the files. That shouldn't prevent one from running a build.

pmario commented 9 years ago

I'm not sure, how we can solve it and I also think, I'm a bit off topic at this issue. ...

What happens if I write --output . ? which imo is an example somewhere.

... I just want to be sure, that we don't delete anything of value, because most users have no backups.

Jermolene commented 9 years ago

The command --output . will change the output directory from the default of the edition/output directory to the current directory.