extract act options from cli command (#117)
* extract act options from cli command * remove special options handled by the tree view * Refactor logic to get act options (#1) * Refactor get options logic * Remove bool type options from having descriptions * Force option description to be uppercase Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com> * disable generic early exit options as well * filter out stringArray default value * this removes default values like `[]` regardless if they are sent * fix quote consitency --------- Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com> Co-authored-by: Sanjula Ganepola <32170854+SanjulaGanepola@users.noreply.github.com>
This commit is contained in:
27
src/act.ts
27
src/act.ts
@@ -120,6 +120,13 @@ export interface CommandArgs {
|
||||
extraHeader: { key: string, value: string }[]
|
||||
}
|
||||
|
||||
export interface ActOption {
|
||||
default: string;
|
||||
name: string,
|
||||
description: string
|
||||
type: string
|
||||
}
|
||||
|
||||
export class Act {
|
||||
static defaultActCommand: string = 'act';
|
||||
static githubCliActCommand: string = 'gh act';
|
||||
@@ -323,6 +330,26 @@ export class Act {
|
||||
}
|
||||
}
|
||||
|
||||
getAllOptions(): Promise<ActOption[]> {
|
||||
return new Promise<ActOption[]>((resolve, reject) => {
|
||||
const exec = childProcess.spawn(
|
||||
`${Act.getActCommand()} --list-options`,
|
||||
{
|
||||
shell: true,
|
||||
}
|
||||
);
|
||||
let options: string = ""
|
||||
exec.stdout.on('data', b => options += b.toString());
|
||||
exec.on('exit', async (code, signal) => {
|
||||
if (code === 0) {
|
||||
resolve(JSON.parse(options));
|
||||
} else {
|
||||
reject(new Error("Not supported by this binary"));
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
async runCommand(commandArgs: CommandArgs) {
|
||||
// Check if required components are ready
|
||||
// const unreadyComponents = await this.componentsManager.getUnreadyComponents();
|
||||
|
||||
Reference in New Issue
Block a user