Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
line.push(this.commandAssignment.value.name);
Object.keys(this._assignments).forEach(function(name) {
var assignment = this._assignments[name];
var type = assignment.param.type;
// TODO: This will cause problems if there is a non-default value
// after a default value. Also we need to decide when to use
// named parameters in place of positional params. Both can wait.
if (assignment.value !== assignment.param.defaultValue) {
line.push(' ');
line.push(type.stringify(assignment.value));
}
}, this);
return line.join('');
}
};
oop.implement(Requisition.prototype, EventEmitter);
exports.Requisition = Requisition;
/**
* An object used during command line parsing to hold the various intermediate
* data steps.
* <p>The 'output' of the update is held in 2 objects: input.hints which is an
* array of hints to display to the user. In the future this will become a
* single value.
* </p><p>The other output value is input.requisition which gives access to an
* args object for use in executing the final command.
*
* </p><p>The majority of the functions in this class are called in sequence by the
* constructor. Their task is to add to <tt>hints</tt> fill out the requisition.
* </p><p>The general sequence is:</p><ul>
* <li>_tokenize(): convert _typed into _parts</li></ul>
line.push(this.commandAssignment.value.name);
Object.keys(this._assignments).forEach(function(name) {
var assignment = this._assignments[name];
var type = assignment.param.type;
// TODO: This will cause problems if there is a non-default value
// after a default value. Also we need to decide when to use
// named parameters in place of positional params. Both can wait.
if (assignment.value !== assignment.param.defaultValue) {
line.push(' ');
line.push(type.stringify(assignment.value));
}
}, this);
return line.join('');
}
};
oop.implement(Requisition.prototype, EventEmitter);
exports.Requisition = Requisition;
/**
* An object used during command line parsing to hold the various intermediate
* data steps.
* <p>The 'output' of the update is held in 2 objects: input.hints which is an
* array of hints to display to the user. In the future this will become a
* single value.
* </p><p>The other output value is input.requisition which gives access to an
* args object for use in executing the final command.
*
* </p><p>The majority of the functions in this class are called in sequence by the
* constructor. Their task is to add to <tt>hints</tt> fill out the requisition.
* </p><p>The general sequence is:</p><ul>
* <li>_tokenize(): convert _typed into _parts</li></ul>
this.value = value;
if (this._settings.persister) {
this._settings.persister.persistValue(this._settings, this.name, value);
}
this._dispatchEvent('change', { setting: this, value: value });
},
/**
* Reset the value of the <code>key</code> setting to it's default
*/
resetValue: function() {
this.set(this.defaultValue);
}
};
oop.implement(Setting.prototype, EventEmitter);
/**
* A base class for all the various methods of storing settings.
* <p>Usage:
* </p><pre> * // Create manually, or require 'settings' from the container.
* // This is the manual version:
* // Add a new setting
* settings.addSetting({ name:'foo', ... });
* // Display the default value
* alert(settings.get('foo'));
* // Alter the value, which also publishes the change etc.
* settings.set('foo', 'bar');
* // Reset the value to the default
* settings.resetValue('foo');</pre>
this.command = options.command;
// Will be used only in the cli case
this.args = options.args;
this.typed = options.typed;
// Have we been initialized?
this._begunOutput = false;
this.start = new Date();
this.end = null;
this.completed = false;
this.error = false;
};
oop.implement(Request.prototype, EventEmitter);
/**
* Return the status of a parameter on the request object.
*/
Request.prototype.getParamStatus = function(param) {
var args = this.args || {};
// Check if there is already a value for this parameter.
if (param.name in args) {
// If there is no value set and then the value is VALID if it's not
// required or INCOMPLETE if not set yet.
if (args[param.name] == null) {
if (param.defaultValue === null) {
return Status.VALID;
} else {
return Status.INCOMPLETE;
line.push(this.commandAssignment.value.name);
Object.keys(this._assignments).forEach(function(name) {
var assignment = this._assignments[name];
var type = assignment.param.type;
// TODO: This will cause problems if there is a non-default value
// after a default value. Also we need to decide when to use
// named parameters in place of positional params. Both can wait.
if (assignment.value !== assignment.param.defaultValue) {
line.push(' ');
line.push(type.stringify(assignment.value));
}
}, this);
return line.join('');
}
};
oop.implement(Requisition.prototype, EventEmitter);
exports.Requisition = Requisition;
/**
* An object used during command line parsing to hold the various intermediate
* data steps.
* <p>The 'output' of the update is held in 2 objects: input.hints which is an
* array of hints to display to the user. In the future this will become a
* single value.
* </p><p>The other output value is input.requisition which gives access to an
* args object for use in executing the final command.
*
* </p><p>The majority of the functions in this class are called in sequence by the
* constructor. Their task is to add to <tt>hints</tt> fill out the requisition.
* </p><p>The general sequence is:</p><ul>
* <li>_tokenize(): convert _typed into _parts</li></ul>
(function(){
oop.implement(this, EventEmitter);
this.$createEditor = function() {
var el = document.createElement("div");
el.className = this.$editorCSS;
el.style.cssText = "position: absolute; top:0px; bottom:0px";
this.$container.appendChild(el);
var session = new EditSession("");
var editor = new Editor(new Renderer(el, this.$theme));
editor.on("focus", function() {
this._emit("focus", editor);
}.bind(this));
this.$editors.push(editor);
editor.setFontSize(this.$fontSize);
return editor;
(function() {
oop.implement(this, EventEmitter);
this.EOF_CHAR = "¶";
this.EOL_CHAR = "¬";
this.TAB_CHAR = "→";
this.SPACE_CHAR = "·";
this.getLineHeight = function() {
return this.$characterSize.height || 1;
};
this.getCharacterWidth = function() {
return this.$characterSize.width || 1;
};
this.checkForSizeChanges = function() {
var size = this.$measureSizes();
(function() {
oop.implement(this, EventEmitter);
this.onScroll = function() {
this._dispatchEvent("scroll", {data: this.element.scrollTop});
};
this.getWidth = function() {
return this.width;
};
this.setHeight = function(height) {
this.element.style.height = height + "px";
};
this.setInnerHeight = function(height) {
this.inner.style.height = height + "px";
};
(function() {
oop.implement(this, EventEmitter);
this.onScroll = function() {
this._dispatchEvent("scroll", {data: this.element.scrollTop});
};
this.getWidth = function() {
return this.width;
};
this.setHeight = function(height) {
this.element.style.height = height + "px";
};
this.setInnerHeight = function(height) {
this.inner.style.height = height + "px";
};
(function() {
oop.implement(this, EventEmitter);
this.setDocument = function(doc) {
if (this.doc)
throw new Error("Document is already set");
this.doc = doc;
doc.on("change", this.onChange.bind(this));
this.on("changeFold", this.onChangeFold.bind(this));
if (this.bgTokenizer) {
this.bgTokenizer.setDocument(this.getDocument());
this.bgTokenizer.start(0);
}
};
this.getDocument = function() {