just playing with tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cli: move cmd_config_list() entry point next to Args struct

+23 -23
+23 -23
cli/src/commands/config/list.rs
··· 51 51 template: Option<String>, 52 52 } 53 53 54 - // AnnotatedValue will be cloned internally in the templater. If the cloning 55 - // cost matters, wrap it with Rc. 56 - fn config_template_language() -> GenericTemplateLanguage<'static, AnnotatedValue> { 57 - type L = GenericTemplateLanguage<'static, AnnotatedValue>; 58 - let mut language = L::new(); 59 - // "name" instead of "path" to avoid confusion with the source file path 60 - language.add_keyword("name", |self_property| { 61 - let out_property = self_property.map(|annotated| annotated.path.to_string()); 62 - Ok(L::wrap_string(out_property)) 63 - }); 64 - language.add_keyword("value", |self_property| { 65 - // TODO: would be nice if we can provide raw dynamically-typed value 66 - let out_property = 67 - self_property.and_then(|annotated| Ok(to_toml_value(&annotated.value)?.to_string())); 68 - Ok(L::wrap_string(out_property)) 69 - }); 70 - language.add_keyword("overridden", |self_property| { 71 - let out_property = self_property.map(|annotated| annotated.is_overridden); 72 - Ok(L::wrap_boolean(out_property)) 73 - }); 74 - language 75 - } 76 - 77 54 #[instrument(skip_all)] 78 55 pub fn cmd_config_list( 79 56 ui: &mut Ui, ··· 129 106 } 130 107 Ok(()) 131 108 } 109 + 110 + // AnnotatedValue will be cloned internally in the templater. If the cloning 111 + // cost matters, wrap it with Rc. 112 + fn config_template_language() -> GenericTemplateLanguage<'static, AnnotatedValue> { 113 + type L = GenericTemplateLanguage<'static, AnnotatedValue>; 114 + let mut language = L::new(); 115 + // "name" instead of "path" to avoid confusion with the source file path 116 + language.add_keyword("name", |self_property| { 117 + let out_property = self_property.map(|annotated| annotated.path.to_string()); 118 + Ok(L::wrap_string(out_property)) 119 + }); 120 + language.add_keyword("value", |self_property| { 121 + // TODO: would be nice if we can provide raw dynamically-typed value 122 + let out_property = 123 + self_property.and_then(|annotated| Ok(to_toml_value(&annotated.value)?.to_string())); 124 + Ok(L::wrap_string(out_property)) 125 + }); 126 + language.add_keyword("overridden", |self_property| { 127 + let out_property = self_property.map(|annotated| annotated.is_overridden); 128 + Ok(L::wrap_boolean(out_property)) 129 + }); 130 + language 131 + }