2020-06-27 18:20:00 +03:00
|
|
|
import { promisified } from './tauri'
|
|
|
|
|
2020-07-13 01:34:44 +03:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2020-06-27 18:20:00 +03:00
|
|
|
/**
|
|
|
|
* gets the CLI matches
|
|
|
|
*/
|
|
|
|
async function getMatches(): Promise<CliMatches> {
|
|
|
|
return await promisified<CliMatches>({
|
|
|
|
cmd: 'cliMatches'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
getMatches
|
|
|
|
}
|