Add more act options to extension settings
Signed-off-by: Sanjula Ganepola <sanjulagane@gmail.com>
This commit is contained in:
@@ -55,7 +55,11 @@ export enum Option {
|
||||
VariableFile = '--var-file',
|
||||
Input = '--input',
|
||||
InputFile = '--input-file',
|
||||
PayloadFile = '--eventpath'
|
||||
PayloadFile = '--eventpath',
|
||||
|
||||
|
||||
ActionCachePath = '--action-cache-path',
|
||||
ActionOfflineMode = '--action-offline-mode'
|
||||
}
|
||||
|
||||
export interface CommandArgs {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import * as os from "os";
|
||||
import * as path from "path";
|
||||
import { ConfigurationTarget, workspace } from 'vscode';
|
||||
|
||||
export enum Platform {
|
||||
@@ -7,7 +9,8 @@ export enum Platform {
|
||||
}
|
||||
|
||||
export enum Section {
|
||||
dockerDesktopPath = 'dockerDesktopPath'
|
||||
dockerDesktopPath = 'dockerDesktopPath',
|
||||
actionCachePath = 'actionCachePath'
|
||||
}
|
||||
|
||||
export namespace ConfigurationManager {
|
||||
@@ -30,6 +33,13 @@ export namespace ConfigurationManager {
|
||||
|
||||
ConfigurationManager.set(Section.dockerDesktopPath, dockerDesktopPath);
|
||||
}
|
||||
|
||||
let actionCachePath = ConfigurationManager.get<string>(Section.actionCachePath);
|
||||
if (!actionCachePath) {
|
||||
actionCachePath = getCacheDirectory(['act']);
|
||||
|
||||
ConfigurationManager.set(Section.actionCachePath, actionCachePath);
|
||||
}
|
||||
}
|
||||
|
||||
export function getSearchTerm(section: Section): string {
|
||||
@@ -43,4 +53,10 @@ export namespace ConfigurationManager {
|
||||
export async function set(section: Section, value: any): Promise<void> {
|
||||
return await workspace.getConfiguration(ConfigurationManager.group).update(section, value, ConfigurationTarget.Global);
|
||||
}
|
||||
|
||||
function getCacheDirectory(paths: string[]) {
|
||||
const userHomeDir = os.homedir();
|
||||
const cacheHomeDir = process.env.XDG_CACHE_HOME || path.join(userHomeDir, '.cache');
|
||||
return path.join(cacheHomeDir, ...paths);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user