UNPKG

2.04 kBTypeScriptView Raw
1import { TextDocument } from 'vscode-languageserver-textdocument';
2import { Range } from 'vscode-languageserver-types';
3import { FlagOption } from './flagOption';
4export declare class Flag {
5 private readonly range;
6 private readonly name;
7 private readonly nameRange;
8 private readonly value;
9 private readonly valueRange;
10 private readonly options;
11 constructor(document: TextDocument, range: Range, name: string, nameRange: Range, value: string | null, valueRange: Range | null);
12 private createFlagOption;
13 toString(): string;
14 /**
15 * Returns the range that encompasses this entire flag. This includes the
16 * -- prefix in the beginning to the last character of the flag's value (if
17 * it has been defined).
18 *
19 * @return the entire range of this flag
20 */
21 getRange(): Range;
22 /**
23 * Returns the name of this flag. The name does not include the -- prefix.
24 * Thus, for HEALTHCHECK's --interval flag, interval is the flag's name and
25 * not --interval.
26 *
27 * @return this flag's name
28 */
29 getName(): string;
30 /**
31 * Returns the range that encompasses the flag's name
32 *
33 * @return the range containing the flag's name
34 */
35 getNameRange(): Range;
36 /**
37 * Returns the value that has been set to this flag. May be null if the
38 * flag is invalid and has no value set like a --start-period. If the flag
39 * is instead a --start-period= with an equals sign then the flag's value
40 * is the empty string.
41 *
42 * @return this flag's value if it has been defined, null otherwise
43 */
44 getValue(): string | null;
45 /**
46 * Returns the range that encompasses this flag's value. If no value has
47 * been set then null will be returned.
48 *
49 * @return the range containing this flag's value, or null if the flag
50 * has no value defined
51 */
52 getValueRange(): Range | null;
53 getOption(name: string): FlagOption | null;
54 getOptions(): FlagOption[];
55 hasOptions(): boolean;
56}