@hashgraph/solo
Version:
An opinionated CLI tool to deploy and manage private Hedera Networks.
67 lines (66 loc) • 2.81 kB
TypeScript
import { type SoloLogger } from './logging/solo-logger.js';
import type * as yargs from 'yargs';
import { type CommandFlag } from '../types/flag-types.js';
import { type ArgvStruct, type AnyListrContext, type AnyObject, type AnyYargs } from '../types/aliases.js';
import { type SoloListrTaskWrapper } from '../types/index.js';
type ConfigMapEntry = {
getUnusedConfigs: () => string[];
};
/**
* ConfigManager cache command flag values so that user doesn't need to enter the same values repeatedly.
*
* For example, 'namespace' is usually remains the same across commands once it is entered, and therefore user
* doesn't need to enter it repeatedly. However, user should still be able to specify the flag explicitly for any command.
*/
export declare class ConfigManager {
private readonly logger?;
config: AnyObject;
protected readonly _configMaps: Map<string, ConfigMapEntry>;
private readonly configScope;
constructor(logger?: SoloLogger);
/** Reset config */
reset(): void;
private getActiveConfig;
cloneActiveConfig(): AnyObject;
runWithScopedConfig<T>(scopedConfig: AnyObject, callback: () => T): T;
/**
* Apply the command flags precedence
*
* It uses the below precedence for command flag values:
* 1. User input of the command flag
* 2. Default value of the command flag if the command is not 'init'.
*/
applyPrecedence(argv: yargs.Argv<AnyYargs>, aliases: AnyObject): yargs.Argv<AnyYargs>;
/** Update the config using the argv */
update(argv: ArgvStruct): void;
/** Check if a flag value is set */
hasFlag(flag: CommandFlag): boolean;
/**
* Return the value of the given flag
* @returns value of the flag or undefined if flag value is not available
*/
getFlag<T = string>(flag: CommandFlag): T;
/** Set value for the flag */
setFlag<T>(flag: CommandFlag, value: T): void;
/** Get package version */
getVersion(): string;
/**
* Run prompts for the given set of flags
* @param task task object from listr2
* @param flagList list of flag objects
*/
executePrompt(task: SoloListrTaskWrapper<AnyListrContext>, flagList?: CommandFlag[]): Promise<void>;
/**
* Dynamically builds a class with properties from the provided list of flags
* and extra properties, will keep track of which properties are used. Call
* getUnusedConfigs() to get an array of unused properties.
*/
getConfig(configName: string, flags: CommandFlag[], extraProperties?: string[]): object;
/**
* Get the list of unused configurations that were not accessed
* @returns an array of unused configurations
*/
getUnusedConfigs(configName: string): string[];
getFlagFile(flag: CommandFlag): string;
}
export {};