From 291bd7fafd2ff4201ac735300420a87198a06fc8 Mon Sep 17 00:00:00 2001 From: Aaron Erhardt Date: Sun, 23 Jun 2024 12:53:10 +0200 Subject: [PATCH] Fix typo --- examples/cli.rs | 2 +- src/cli.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/cli.rs b/examples/cli.rs index 97429b9..967fb32 100644 --- a/examples/cli.rs +++ b/examples/cli.rs @@ -56,7 +56,7 @@ fn main() { /* ANCHOR: main */ let program_invocation = std::env::args().next().unwrap(); let mut gtk_args = vec![program_invocation]; - gtk_args.append(&mut args.gtk_options.clone()); + gtk_args.extend(args.gtk_options.clone()); let app = RelmApp::new("relm4.test.helloworld_cli"); app.with_args(gtk_args).run::(()); diff --git a/src/cli.md b/src/cli.md index faef258..02643ff 100644 --- a/src/cli.md +++ b/src/cli.md @@ -10,7 +10,7 @@ The easiest way is to just provide an empty `Vec` but this has the disadvantage We will now make it work in combination with the popular [`clap`](https://docs.rs/clap/latest/clap/) crate. To be precise we will use the `derive` feature which you can learn about in the [`clap` documentation](https://docs.rs/clap/latest/clap/_derive/_tutorial/chapter_0/index.html) but it works with the builder pattern too of course. -To pass a `Vec` of GTK arguments we need to separate the arguments we want to consume ourselfes from those we want to pass to GTK. +To pass a `Vec` of GTK arguments we need to separate the arguments we want to consume ourselves from those we want to pass to GTK. In `clap` you can achieve this using a combination of [`allow_hyphen_values`](https://docs.rs/clap/latest/clap/struct.Arg.html#method.allow_hyphen_values) and [`trailing_var_arg`](https://docs.rs/clap/latest/clap/struct.Arg.html#method.trailing_var_arg). ```rust,no_run,noplayground {{#include ../examples/cli.rs:args_struct }}