diff --git a/src/commands/common.ts b/src/commands/common.ts index 912286c..8b92f4d 100644 --- a/src/commands/common.ts +++ b/src/commands/common.ts @@ -3,6 +3,7 @@ export function undefList(opt: T | undefined, fn: (opt: T) => U) { } export const optFlag = (flag: string, opt: string | undefined) => undefList(opt, opt => [flag, opt]) +export const optFlagEq = (flag: string, opt: string | undefined) => undefList(opt, opt => [`${flag}=${opt}`]) /** * Generate a switch flag, like "--rebuild", "--nobuild" diff --git a/src/commands/gn.ts b/src/commands/gn.ts new file mode 100644 index 0000000..8866f60 --- /dev/null +++ b/src/commands/gn.ts @@ -0,0 +1,14 @@ +import { optFlagEq } from "./common.js"; + +export interface GeneralOptions { + /** + * Specifies build arguments overrides. + */ + args?: string[] +} + +export function generalOptions(o: GeneralOptions) { + return [ + ...optFlagEq("--args", o.args?.join(' ')), + ] +}