@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
37 lines (36 loc) • 1.32 kB
TypeScript
/**
* this class represents a string that can be evaluated in bash scripts.
*
* you can do basic transforms like lowercase, but that does not return you a lowercase string, but instead an experssion represeting a lowercase string
*/
export declare class BashExpression {
private value;
constructor(value: string | BashExpression);
toJSON(): string;
toString(): string;
replace(searchValue: any, replacer: (substring: string, ...args: any[]) => string): BashExpression;
/**
*
* @returns a bash expression to lowercase the string
*/
toLowerCase(): BashExpression;
/**
* concats a value to this one and returns a new BashExpression
* @param value
* @returns
*/
concat(...values: Array<string | BashExpression>): BashExpression;
transformWithCommand(command: string): BashExpression;
}
export type StringOrBashExpression = string | BashExpression;
export declare const getBashVariable: (name: string) => BashExpression;
/**
* joins bash expressions together with a joiner
* returns a bash expression if any of the parts is a bash expression
* returns a string otherwise
*
* @param parts
* @param joiner
* @returns
*/
export declare const joinBashExpressions: (parts: Array<StringOrBashExpression>, joiner?: string) => StringOrBashExpression;