GNOME Bugzilla – Bug 338860
Export to Separate HTML Files
Last modified: 2012-05-01 16:57:59 UTC
I'd really love a way to say (especially from the command-line, silently, so I could use it in scripts), "Export the note named Ideas, recursively following links, and put each note in a separate file."
Setting the default assignee and QA Contact to "tomboy-maint@gnome.bugs".
Past feature freeze. Pushing to next cycle.
This bgo relates to #356871 and I wonder if it would take very much for Robert to add the command-line support?
I've snooped around, and it seems to be quite possible to add this to the command line as any actions (like New Note etc.) are delayed until after add-ins are loaded. Presumably we would make the application quit after export to make it silent-like, although at any rate the tomboy icon will show up for a split second on the taskbar because of the aforementioned loading in. The big question is one of principle: Should we hard-code command-line actions referring to an add-in that may be disabled or missing? It would be easy to just check for that and return nothing, but should we have command-line options where we can't guarantee consistent behaviour?
I could see returning a message "Not implemented". It's probably not "best practice", but surely it could be acceptable.
I had a brainwave and came up with a better-practice way of doing it, which I've already implemented to the point of working with export locations without spaces. (Needs some more polish and error management to be finished.) By making the TomboyCommandLine a public property of the NoteManager, all add-ins can hook up to an event which is fired when an arg starting with "--addin:" is encountered. They can then process these args as needed. For example, the ExportAllApplication add-in is now wired so that when you pass "--addin:XXXexportall /home/rpvn/exports/yay", the appropriate subclassed exporter will do a GUI-less export all to that location. The great advantage of this method is that not only do we get command-line html export, but also export to any other format you like, and we will also have established a framework for arbitrary application add-ins to define command-line args.
I like it.
Sorry, command line arguments are processed before add-ins are loaded. To do otherwise really hurts start up. Any solution that involved command line arguments being passed to add-ins would need to prove that it didn't slow things down.
I'm sorry, i may have formulated myself unclearly. From what I can see, the actual argument parsing happens before add-in loading (indeed before most loading of anything), but any actions needing full Tomboy functionality like "Create New Note" are deferred until after loading is completed via a needsexecute bool set during parsing and an execute call after loading is complete. The way I'm setting it up, when the parsing finds an "addin:" a bool is set just like for the other tasks, and the event is fired during the execute call. I don't really think there will be any significant impact on start-up time. (But since the proof is in the pudding, the patch will soonish be ready for testing.)
Ah, I see. That makes sense, though I'm not sure how user friendly that is. Still, better than nothing.
Created attachment 193899 [details] [review] Patch allowing commandline args to be parsed by add-ins This patch is my proposed solution. I don't think it carries any significant performance penalty. The ExportAllAddin has been modified and will now accept the command --addin:html-export-all and --addin:html-export-all-quit for exporting all notes. (All Export All Add-ins will work with the --addin:XXX-export-all format, for example --addin:txt-export-all which works with my text exporter without any modifications to the add-in DLL.)
Rob, The example of --addin:html-export-all doesn't actually do anything yet right? I also tried [1] with no results. [1]tomboy --addin:txt-export-all ~/temp/tomboy/
Erh, As far as I remember it worked properly when I submitted the patch. Just to be sure, you applied the patch manually before building? Because it has never actually been committed, since nobody followed up on it until now. Also, the relevant add-ins have to be installed and enabled. It might actually be the ~ that isn't being handled correctly, but there should be an error printed when it fails.
Ya, there was something up with my build. Here's the command lines I tried that worked for me. tomboy --debug --addin:html-export-all /home/jjennings/temp/tomboy/html/ tomboy --debug --addin:html-export-all /home/jjennings/temp/tomboy/html2 tomboy --debug --addin:html-export-all-quit /home/jjennings/temp/tomboy/html-quit tomboy --debug --addin:txt-export-all-quit /home/jjennings/temp/tomboy/txt-quit The documentation of this will get a bit tricky.
Review of attachment 193899 [details] [review]: These changes have been committed. Shall the bug be closed out?
I'll add some documentation to https://live.gnome.org/Tomboy/HowToCreateAddins on using command line arguments for add-ins, but maybe we should hold off with closing this bug entirely until we update the commandline --help argument to inform of the new options. I'll get right on that!
Created attachment 212935 [details] [review] Patch to add info on html eport to --help option This patch adds some info to the --help command, Now I'd say we can close this bug.
Review of attachment 212935 [details] [review]: Committed a4a8b32174833f8351eb59ebbee8034710e90d87