import { inputPrompt } from "./interactive"; import type { Arg, PromptConfig } from "./interactive"; export const processArgument = async ( args: Record, name: string, promptConfig: PromptConfig ) => { const value = args[name]; const result = await inputPrompt({ ...promptConfig, // Accept the default value if the arg is already set acceptDefault: promptConfig.acceptDefault ?? value !== undefined, defaultValue: value ?? promptConfig.defaultValue, }); // Update value in args before returning the result args[name] = result as Arg; return result; };