Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronErhardt committed Jun 23, 2024
1 parent ad6b469 commit 291bd7f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<AppModel>(());
Expand Down
2 changes: 1 addition & 1 deletion src/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down

0 comments on commit 291bd7f

Please sign in to comment.