(
action: string,
bag: ParsedOptionBag,
common: CommandCommonOptions & { help?: boolean }
)
| 251 | } |
| 252 | |
| 253 | function parseStrategyCommand( |
| 254 | action: string, |
| 255 | bag: ParsedOptionBag, |
| 256 | common: CommandCommonOptions & { help?: boolean } |
| 257 | ): ParsedCliCommand { |
| 258 | if (action !== "run") { |
| 259 | throw new CommandParseError(`Unsupported strategy action '${action}'`); |
| 260 | } |
| 261 | assertAllowedOptions(bag.options, new Set([...GLOBAL_OPTION_NAMES, "strategy", "silent"])); |
| 262 | const strategyInput = readStringOption(bag.options, ["strategy"]) ?? bag.positionals[0]; |
| 263 | if (!strategyInput) { |
| 264 | throw new CommandParseError("Missing required option --strategy for strategy run"); |
| 265 | } |
| 266 | const strategy = normalizeStrategy(strategyInput); |
| 267 | const silent = readBooleanOption(bag.options, ["silent"], false); |
| 268 | return { kind: "strategy-run", strategy, silent, ...common }; |
| 269 | } |
| 270 | |
| 271 | function parseOrderCreatePayload(options: Record<string, string | boolean>): OrderCreatePayload { |
| 272 | const side = normalizeSide(requireStringOption(options, ["side"], "Missing required option --side")); |
no test coverage detected