lots of work fixing bugs with the command line, also removal of useless console.log
This commit is contained in:
parent
1e65d71bde
commit
9cff2e0908
10 changed files with 385 additions and 240 deletions
|
|
@ -84,22 +84,15 @@ var setCommandSpec = {
|
|||
'<br/>';
|
||||
});
|
||||
} else {
|
||||
var setting = env.settings.get(args.setting);
|
||||
if (!setting) {
|
||||
request.doneWithError('No setting with the name <strong>' +
|
||||
setting.name + '</strong>.');
|
||||
return;
|
||||
}
|
||||
|
||||
// set with only a setting, shows the value for that setting
|
||||
if (args.value === undefined) {
|
||||
html = '<strong>' + setting.name + '</strong> = ' +
|
||||
setting.get();
|
||||
} else {
|
||||
// Actually change the setting
|
||||
setting.set(args.value);
|
||||
html = 'Setting: <strong>' + setting.name + '</strong> = ' +
|
||||
setting.get();
|
||||
args.setting.set(args.value);
|
||||
html = 'Setting: <strong>' + args.setting.name + '</strong> = ' +
|
||||
args.setting.get();
|
||||
}
|
||||
}
|
||||
request.done(html);
|
||||
|
|
|
|||
|
|
@ -50,10 +50,8 @@ packages.unshift("require", "exports", "module");
|
|||
|
||||
define(packages, function(require, exports, module) {
|
||||
|
||||
console.log(packages);
|
||||
exports.startup = function(data, reason) {
|
||||
deps.forEach(function(dep) {
|
||||
console.log("test startup for " + dep);
|
||||
var module = require(dep);
|
||||
if (typeof module.startup === "function") {
|
||||
module.startup(data, reason);
|
||||
|
|
|
|||
|
|
@ -128,32 +128,32 @@ SelectionType.prototype.parse = function(str) {
|
|||
}
|
||||
var data = (typeof(this.data) === "function") ? this.data() : this.data;
|
||||
|
||||
var match;
|
||||
// The matchedValue could be the boolean value false
|
||||
var hasMatched = false;
|
||||
var matchedValue;
|
||||
var completions = [];
|
||||
data.forEach(function(option) {
|
||||
if (str == option) {
|
||||
match = this.fromString(option);
|
||||
matchedValue = this.fromString(option);
|
||||
hasMatched = true;
|
||||
}
|
||||
else if (option.indexOf(str) === 0) {
|
||||
completions.push(this.fromString(option));
|
||||
}
|
||||
}, this);
|
||||
|
||||
if (match) {
|
||||
return new Conversion(match);
|
||||
if (hasMatched) {
|
||||
return new Conversion(matchedValue);
|
||||
}
|
||||
else {
|
||||
if (completions.length > 0) {
|
||||
return new Conversion(null,
|
||||
Status.INCOMPLETE,
|
||||
'Several possibilities for \'' + str + '\'',
|
||||
completions);
|
||||
var msg = 'Several possibilities' +
|
||||
(str.length === 0 ? '' : ' for \'' + str + '\'');
|
||||
return new Conversion(null, Status.INCOMPLETE, msg, completions);
|
||||
}
|
||||
else {
|
||||
return new Conversion(null,
|
||||
Status.INVALID,
|
||||
'Can\'t use \'' + str + '\'.',
|
||||
completions);
|
||||
var msg = 'Can\'t use \'' + str + '\'.';
|
||||
return new Conversion(null, Status.INVALID, msg, completions);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -203,7 +203,6 @@ DeferredType.prototype.stringify = function(value) {
|
|||
};
|
||||
|
||||
DeferredType.prototype.parse = function(value) {
|
||||
console.log(this.defer);
|
||||
return this.defer().parse(value);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue