Function tauri::api::cli::get_matches

source ·
pub fn get_matches(
    cli: &CliConfig,
    package_info: &PackageInfo
) -> Result<Matches>
Available on crate feature cli only.
Expand description

Gets the argument matches of the CLI definition.

This is a low level API. If the application has been built, prefer App::get_cli_matches.

Examples

use tauri::api::cli::get_matches;
tauri::Builder::default()
  .setup(|app| {
    let matches = get_matches(app.config().tauri.cli.as_ref().unwrap(), app.package_info())?;
    Ok(())
  });
Examples found in repository?
src/app.rs (line 753)
751
752
753
754
755
756
757
  pub fn get_cli_matches(&self) -> crate::Result<crate::api::cli::Matches> {
    if let Some(cli) = &self.manager.config().tauri.cli {
      crate::api::cli::get_matches(cli, self.manager.package_info()).map_err(Into::into)
    } else {
      Ok(Default::default())
    }
  }
More examples
Hide additional examples
src/endpoints/cli.rs (line 25)
23
24
25
26
27
28
29
30
31
  fn cli_matches<R: Runtime>(context: InvokeContext<R>) -> super::Result<InvokeResponse> {
    if let Some(cli) = &context.config.tauri.cli {
      crate::api::cli::get_matches(cli, &context.package_info)
        .map(Into::into)
        .map_err(Into::into)
    } else {
      Ok(crate::api::cli::Matches::default().into())
    }
  }