File: /home/f/r/e/frenchy/www/french-american.org/current/node_modules/dockerfile-ast/lib/flag.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Flag {
constructor(range, name, nameRange, value, valueRange) {
this.range = range;
this.name = name;
this.nameRange = nameRange;
this.value = value;
this.valueRange = valueRange;
}
toString() {
if (this.valueRange) {
return "--" + this.name + "=" + this.value;
}
return "--" + this.name;
}
/**
* Returns the range that encompasses this entire flag. This includes the
* -- prefix in the beginning to the last character of the flag's value (if
* it has been defined).
*
* @return the entire range of this flag
*/
getRange() {
return this.range;
}
/**
* Returns the name of this flag. The name does not include the -- prefix.
* Thus, for HEALTHCHECK's --interval flag, interval is the flag's name and
* not --interval.
*
* @return this flag's name
*/
getName() {
return this.name;
}
/**
* Returns the range that encompasses the flag's name
*
* @return the range containing the flag's name
*/
getNameRange() {
return this.nameRange;
}
/**
* Returns the value that has been set to this flag. May be null if the
* flag is invalid and has no value set like a --start-period. If the flag
* is instead a --start-period= with an equals sign then the flag's value
* is the empty string.
*
* @return this flag's value if it has been defined, null otherwise
*/
getValue() {
return this.value;
}
/**
* Returns the range that encompasses this flag's value. If no value has
* been set then null will be returned.
*
* @return the range containing this flag's value, or null if the flag
* has no value defined
*/
getValueRange() {
return this.valueRange;
}
}
exports.Flag = Flag;