replacement in src/main.rs at line 1
− use xilem_html::{document_body, elements as el, App, View, ViewExt, ViewMarker};
replacement in src/main.rs at line 3
[3.70]→[3.70:83](∅→∅),
[3.83]→[3.0:118](∅→∅) − pub mod cli;
− use clap::{parser::ValueSource, CommandFactory};
− use clap_builder::{parser::MatchedArg, util::any_value::AnyValueId};
+ use clap::parser::ValueSource;
+ use clap::{value_parser, ArgMatches, CommandFactory};
edit in src/main.rs at line 6
+ use xilem_html::{document_body, elements as el, App, View, ViewExt, ViewMarker};
edit in src/main.rs at line 10
replacement in src/main.rs at line 12
+ arg_matches: Result<ArgMatches, clap::Error>,
replacement in src/main.rs at line 15
− struct ArgState {
− name: String,
− source: ValueSource,
− raw_values: Vec<String>,
− // Keep the value as a string, but store its corresponding type info
− type_id: AnyValueId,
+ impl Default for AppState {
+ fn default() -> Self {
+ Self {
+ command: String::new(),
+ arg_matches: Err(clap::Error::new(clap::error::ErrorKind::TooFewValues)),
+ }
+ }
edit in src/main.rs at line 30
[3.292]→[3.292:359](∅→∅),
[3.359]→[3.336:388](∅→∅) − let matches = cli_command.try_get_matches_from(args_iter);
− tracing::debug!("Matches: {:#?}", matches);
replacement in src/main.rs at line 32
[3.455]→[3.455:570](∅→∅),
[3.570]→[3.229:280](∅→∅),
[3.229]→[3.229:280](∅→∅) − self.args = if let Ok(matches) = matches {
− matches.args.iter().map(matched_to_state).collect()
− } else {
− Vec::new()
− };
+ self.arg_matches = cli_command.try_get_matches_from(args_iter);
+ tracing::debug!("Matches: {:#?}", self.arg_matches);
edit in src/main.rs at line 36
−
− fn matched_to_state(key_value: (&clap::Id, &MatchedArg)) -> ArgState {
− let (key, value) = key_value;
replacement in src/main.rs at line 37
[3.281]→[3.686:1077](∅→∅),
[3.1077]→[3.397:403](∅→∅),
[3.397]→[3.397:403](∅→∅),
[3.403]→[3.629:631](∅→∅),
[3.629]→[3.629:631](∅→∅) − ArgState {
− name: key.to_string(),
− source: value.source().unwrap_or(ValueSource::DefaultValue),
− raw_values: value
− .raw_vals()
− .flatten()
− .map(|raw_value| raw_value.to_string_lossy().to_string())
− .collect(),
− type_id: value
− .type_id()
− .unwrap_or(AnyValueId::of::<dyn std::any::Any>()),
− }
− }
+ fn arg_item(matches: &ArgMatches, arg: &clap::Arg) -> impl View<AppState> + ViewMarker {
+ tracing::debug!("`{:?}`", matches.contains_id("name"));
+ let source = if let Some(source) = matches.value_source(arg.get_id().as_str()) {
+ match source {
+ ValueSource::DefaultValue => "default",
+ ValueSource::EnvVariable => "environment",
+ ValueSource::CommandLine => "cmdline",
+ _ => "todo",
+ }
+ } else {
+ "none"
+ };
replacement in src/main.rs at line 50
[3.632]→[3.1078:1347](∅→∅) − fn arg_item(arg: &ArgState) -> impl View<AppState> + ViewMarker {
− let source = match arg.source {
− ValueSource::DefaultValue => "default",
− ValueSource::EnvVariable => "environment",
− ValueSource::CommandLine => "cmdline",
− _ => "todo",
+ let type_id = arg.get_value_parser().type_id();
+ let type_name = if type_id == value_parser!(String).type_id() {
+ "string".to_string()
+ } else {
+ format!("{:?}", type_id)
edit in src/main.rs at line 56
replacement in src/main.rs at line 58
[3.1368]→[3.1368:1570](∅→∅) − el::h2(arg.name.clone()),
− el::div((
− format!("{:?}", arg.type_id),
− el::div("test").attr("class", "hover_content"),
− ))
− .attr("class", "hoverable"),
+ el::div((type_name, el::div("test").attr("class", "hover_content")))
+ .attr("class", "hoverable"),
replacement in src/main.rs at line 62
[3.1611]→[3.1611:1710](∅→∅) − arg.raw_values
− .iter()
− .map(|arg| el::li(arg.clone()))
+ matches
+ .get_raw_occurrences(&arg.get_id().as_str())
+ .unwrap_or_default()
+ .map(|os_strings| {
+ el::li({
+ os_strings
+ .map(|s| s.to_string_lossy().to_string())
+ .collect::<Vec<String>>()
+ .join(" ")
+ })
+ })
edit in src/main.rs at line 84
+ let default_matches = ArgMatches::default();
+ let arg_matches = state.arg_matches.as_ref().unwrap_or(&default_matches);
+ tracing::debug!("{:?}", arg_matches);
replacement in src/main.rs at line 89
[3.921]→[3.0:114](∅→∅),
[3.114]→[3.6982:7039](∅→∅),
[3.101]→[3.161:172](∅→∅),
[3.190]→[3.161:172](∅→∅),
[3.7039]→[3.161:172](∅→∅),
[3.161]→[3.161:172](∅→∅) − el::div((
− el::div(state.args.iter().map(arg_item).collect::<Vec<_>>()).attr("id", "sidebar"),
− el::div(docs::test()).attr("id", "content"),
− ))
+ el::div((el::div(
+ MockApp::command()
+ .get_opts()
+ .filter(|arg| arg_matches.try_contains_id(arg.get_id().as_str()).is_ok())
+ .map(|arg| arg_item(&arg_matches, arg))
+ .collect::<Vec<_>>(),
+ )
+ .attr("id", "sidebar"),))
edit in docs/test.typ at line 1
[3.242]→[2.13749:13771](∅→∅) replacement in Cargo.toml at line 10
[3.1345]→[3.1976:2076](∅→∅) − clap = { path = "../clap", features = ["derive"] }
− clap_builder = { path = "../clap/clap_builder" }
+ clap = { version = "4.4.8", features = ["derive"] }
+ # clap_builder = "4.4.8"
replacement in Cargo.lock at line 306
[3.2160]→[3.2160:2178](∅→∅) + version = "4.4.8"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64"
replacement in Cargo.lock at line 316
[3.2408]→[3.2408:2426](∅→∅) + version = "4.4.8"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc"
replacement in Cargo.lock at line 328
[3.2671]→[3.2671:2689](∅→∅) + version = "4.4.7"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
replacement in Cargo.lock at line 340
[3.2925]→[3.2925:2943](∅→∅) + version = "0.6.0"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
edit in Cargo.lock at line 1026
[3.3493]→[3.2316:2333](∅→∅) edit in Cargo.lock at line 1984
[3.22874]→[3.24101:24188](∅→∅) − source = "git+https://github.com/typst/typst#3a1e47913d874647e5d8d013a7e21beca96453d6"
edit in Cargo.lock at line 2034
[3.24230]→[3.24230:24317](∅→∅) − source = "git+https://github.com/typst/typst#3a1e47913d874647e5d8d013a7e21beca96453d6"
edit in Cargo.lock at line 2074
[3.23619]→[3.24838:24925](∅→∅) − source = "git+https://github.com/typst/typst#3a1e47913d874647e5d8d013a7e21beca96453d6"
edit in Cargo.lock at line 2084
[3.23828]→[3.24926:25013](∅→∅) − source = "git+https://github.com/typst/typst#3a1e47913d874647e5d8d013a7e21beca96453d6"