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:
ChristopherHX
2025-01-18 23:43:31 +01:00
committed by GitHub
parent ed60ff43c6
commit dc301e47e0
2 changed files with 242 additions and 188 deletions

View File

@@ -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();