diff --git a/src/commands/generate/data.ts b/src/commands/generate/data.ts index 0a877e1..1e93c39 100644 --- a/src/commands/generate/data.ts +++ b/src/commands/generate/data.ts @@ -3,6 +3,7 @@ import { ConfigType, OutConfigType } from "../../utils/shared"; export type GenerateConfigType = { src?: string; + absolute?: boolean } & OutConfigType & ConfigType; @@ -17,4 +18,9 @@ export const generateOptions: ProgramOptionsType[] = [ defaultValue: ".", description: "Relative path where generated files are written", }, + { + name: "absolute", + defaultValue: true, + description: "If the paths used for generating types should be absolute or relative", + }, ]; diff --git a/src/commands/generate/index.ts b/src/commands/generate/index.ts index d00e4da..4a1980f 100644 --- a/src/commands/generate/index.ts +++ b/src/commands/generate/index.ts @@ -8,10 +8,10 @@ import { generateGDScriptPathsFile } from "./generate-script"; import { generateUtils } from "./generate-utils"; export const generateAction = async (passedConfig: GenerateConfigType) => { - const { src, out } = passedConfig; + const { src, out, absolute } = passedConfig; - const resolvedSrc = resolve(src); - const resolvedOut = resolve(out); + const resolvedSrc = absolute ? resolve(src) : src; + const resolvedOut = absolute ? resolve(out) : out; const gdScriptPaths = await glob(`${resolvedSrc}/**/*.gd`, { ignore: [`**/.godot/**`],