commands: add gn general options

This commit is contained in:
2024-09-01 12:53:40 +08:00
parent 58e0bf3e5b
commit bce30a0b8b
2 changed files with 15 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ export function undefList<T, U>(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"

14
src/commands/gn.ts Normal file
View File

@@ -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(' ')),
]
}