/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */

//#region ../cli/dist/lib/args.mjs
/*! © 2026 Yahoo, Inc. UDS CLI v0.0.0-development */
/**
* Parse command line arguments.
* @param argv - Arguments to parse (typically process.argv.slice(2))
* @returns Parsed positional args and options
*/
function parseArgs(argv) {
	const positional = [];
	const options = {};
	for (let i = 0; i < argv.length; i++) {
		const arg = argv[i];
		if (arg.startsWith("--")) {
			const key = arg.slice(2);
			const next = argv[i + 1];
			options[key] = next && !next.startsWith("-") ? (i++, next) : "true";
		} else if (arg.startsWith("-") && arg.length === 2) {
			const key = arg.slice(1);
			const next = argv[i + 1];
			options[key] = next && !next.startsWith("-") ? (i++, next) : "true";
		} else positional.push(arg);
	}
	return {
		positional,
		options
	};
}

//#endregion
exports.parseArgs = parseArgs;