mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-24 11:14:40 +03:00
38 lines
642 B
TypeScript
38 lines
642 B
TypeScript
import { promisified } from './tauri'
|
|
|
|
export interface ArgMatch {
|
|
/**
|
|
* string if takes value
|
|
* boolean if flag
|
|
* string[] or null if takes multiple values
|
|
*/
|
|
value: string | boolean | string[] | null
|
|
/**
|
|
* number of occurrences
|
|
*/
|
|
occurrences: number
|
|
}
|
|
|
|
export interface SubcommandMatch {
|
|
name: string
|
|
matches: CliMatches
|
|
}
|
|
|
|
export interface CliMatches {
|
|
args: { [name: string]: ArgMatch }
|
|
subcommand: SubcommandMatch | null
|
|
}
|
|
|
|
/**
|
|
* gets the CLI matches
|
|
*/
|
|
async function getMatches(): Promise<CliMatches> {
|
|
return await promisified<CliMatches>({
|
|
cmd: 'cliMatches'
|
|
})
|
|
}
|
|
|
|
export {
|
|
getMatches
|
|
}
|