diff --git a/core/language/en-GB/Help/editions.tid b/core/language/en-GB/Help/editions.tid new file mode 100644 index 000000000..42ccab998 --- /dev/null +++ b/core/language/en-GB/Help/editions.tid @@ -0,0 +1,8 @@ +title: $:/language/Help/editions +description: Lists the available editions of TiddlyWiki + +Lists the names and descriptions of the available editions. You can create a new wiki of a specified edition with the `--init` command. + +``` +--editions +``` diff --git a/core/language/en-GB/Help/init.tid b/core/language/en-GB/Help/init.tid index 71a7be224..c144b0d68 100644 --- a/core/language/en-GB/Help/init.tid +++ b/core/language/en-GB/Help/init.tid @@ -20,4 +20,4 @@ Note: * The init command will fail if the wiki folder is not empty * The init command removes any `includeWikis` definitions in the edition's `tiddlywiki.info` file * When multiple editions are specified, editions initialised later will overwrite any files shared with earlier editions (so, the final `tiddlywiki.info` file will be copied from the last edition) -* `--help editions` returns a list of available editions +* `--editions` returns a list of available editions diff --git a/core/modules/commands/editions.js b/core/modules/commands/editions.js new file mode 100644 index 000000000..271b62e71 --- /dev/null +++ b/core/modules/commands/editions.js @@ -0,0 +1,62 @@ +/*\ +title: $:/core/modules/commands/editions.js +type: application/javascript +module-type: command + +Command to list the available editions + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports.info = { + name: "editions", + synchronous: true +}; + +var Command = function(params,commander) { + this.params = params; + this.commander = commander; +}; + +Command.prototype.execute = function() { + var fs = require("fs"), + path = require("path"), + self = this; + // Enumerate the edition paths + var editionPaths = $tw.getLibraryItemSearchPaths($tw.config.editionsPath,$tw.config.editionsEnvVar), + editions = {}; + for(var editionIndex=0; editionIndex