/** * Completion Context Parser * * Parses command line input to determine the current completion context. */ import { CompletionInput, CompletionContext, CompletionOptions, ApiPathInfo } from "./types.d.ts"; /** * Check if an option requires a value */ export declare function optionNeedsValue(option: string): boolean; /** * Check if an option is a boolean flag */ export declare function isBooleanOption(option: string): boolean; /** * Parse dot-separated API path into parts * Handles special cases like quoted segments */ export declare function parseDotSeparatedPath(path: string): string[]; /** * Parse partial API path input to determine completion context * * Examples: * - "pet" -> { partial: "pet", completing: "spec" } * - "petstore." -> { specName: "petstore", partial: "", completing: "tag" } * - "petstore.pet." -> { specName: "petstore", tagName: "pet", partial: "", completing: "api" } * - "petstore.pet.get" -> { specName: "petstore", tagName: "pet", partial: "get", completing: "api" } * * With fixedSpecName="yuque": * - "doc" -> { specName: "yuque", partial: "doc", completing: "tag" } * - "doc." -> { specName: "yuque", tagName: "doc", partial: "", completing: "api" } * - "doc.read" -> { specName: "yuque", tagName: "doc", partial: "read", completing: "api" } * * With singleSpecName="petstore" and hasTags=true: * - "pet" -> { specName: "petstore", partial: "pet", completing: "tag" } * - "pet." -> { specName: "petstore", tagName: "pet", partial: "", completing: "api" } * - "pet.get" -> { specName: "petstore", tagName: "pet", partial: "get", completing: "api" } * * With singleSpecName="petstore" and hasTags=false: * - "getPet" -> { specName: "petstore", partial: "getPet", completing: "api" } */ export declare function parsePartialApiPath(partial: string, fixedSpecName?: string, singleSpecName?: string, hasTags?: boolean): ApiPathInfo; /** * Parse words into options and positional arguments */ export declare function parseWordsToOptionsAndArgs(words: string[]): { options: Set; args: string[]; }; /** * Parse completion input to determine context * * @param input Completion input from shell * @param options Completion engine options * @returns Parsed completion context */ export declare function parseCompletionContext(input: CompletionInput, options?: CompletionOptions): CompletionContext; /** * Create a CompletionInput from shell environment variables * * @param line COMP_LINE - the full command line * @param wordIndex COMP_CWORD - current word index * @param cursor COMP_POINT - cursor position (optional) * @returns CompletionInput */ export declare function createCompletionInput(line: string, wordIndex: number, cursor?: number): CompletionInput;