feedback changes

pull/2787/head
Mike Wyatt 4 weeks ago
parent 8408ffb037
commit e6eb455f24

@ -0,0 +1,5 @@
---
"cli": minor
---
Added `tauri_plugin_cli::matches_from`. This can be combined with the `args` passed to the callback of `tauri_plugin_single_instance` to parse the command line arguments passed to subsequent instances of the application.

@ -28,8 +28,12 @@ pub use parser::{ArgData, Matches, SubcommandMatches};
pub struct Cli<R: Runtime>(PluginApi<R, Config>);
impl<R: Runtime> Cli<R> {
pub fn matches(&self, args: Option<Vec<String>>) -> Result<parser::Matches> {
parser::get_matches(self.0.config(), self.0.app().package_info(), args)
pub fn matches(&self) -> Result<parser::Matches> {
parser::get_matches(self.0.config(), self.0.app().package_info(), None)
}
pub fn matches_from(&self, args: Vec<String>) -> Result<parser::Matches> {
parser::get_matches(self.0.config(), self.0.app().package_info(), Some(args))
}
}
@ -45,7 +49,7 @@ impl<R: Runtime, T: Manager<R>> CliExt<R> for T {
#[tauri::command]
fn cli_matches<R: Runtime>(_app: AppHandle<R>, cli: State<'_, Cli<R>>) -> Result<parser::Matches> {
cli.matches(None::<Vec<String>>)
cli.matches()
}
pub fn init<R: Runtime>() -> TauriPlugin<R, Config> {

Loading…
Cancel
Save