kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Update command line processing to allow a wiki path to be specified
rodzic
63f52dad9e
commit
c76d038b8e
11
core/boot.js
11
core/boot.js
|
@ -404,7 +404,16 @@ if(!$tw.browser) {
|
||||||
// System paths and filenames
|
// System paths and filenames
|
||||||
$tw.boot.bootFile = path.basename(module.filename);
|
$tw.boot.bootFile = path.basename(module.filename);
|
||||||
$tw.boot.bootPath = path.dirname(module.filename);
|
$tw.boot.bootPath = path.dirname(module.filename);
|
||||||
$tw.boot.wikiPath = process.cwd();
|
// If the first command line argument doesn't start with `--` then we
|
||||||
|
// interpret it as the path to the wiki folder, which will otherwise default
|
||||||
|
// to the current folder
|
||||||
|
$tw.boot.argv = Array.prototype.slice.call(process.argv,2);
|
||||||
|
if($tw.boot.argv[0] && $tw.boot.argv[0].indexOf("--") !== 0) {
|
||||||
|
$tw.boot.wikiPath = $tw.boot.argv[0];
|
||||||
|
$tw.boot.argv = $tw.boot.argv.slice(1);
|
||||||
|
} else {
|
||||||
|
$tw.boot.wikiPath = process.cwd();
|
||||||
|
}
|
||||||
// Read package info
|
// Read package info
|
||||||
$tw.packageInfo = JSON.parse(fs.readFileSync($tw.boot.bootPath + "/../package.json"));
|
$tw.packageInfo = JSON.parse(fs.readFileSync($tw.boot.bootPath + "/../package.json"));
|
||||||
// Check node version number
|
// Check node version number
|
||||||
|
|
|
@ -130,7 +130,7 @@ exports.startup = function() {
|
||||||
} else {
|
} else {
|
||||||
// On the server, start a commander with the command line arguments
|
// On the server, start a commander with the command line arguments
|
||||||
commander = new $tw.Commander(
|
commander = new $tw.Commander(
|
||||||
Array.prototype.slice.call(process.argv,2),
|
$tw.boot.argv,
|
||||||
function(err) {
|
function(err) {
|
||||||
if(err) {
|
if(err) {
|
||||||
console.log("Error: " + err);
|
console.log("Error: " + err);
|
||||||
|
|
Ładowanie…
Reference in New Issue