| 63 | } |
| 64 | |
| 65 | fn read_table<'a>(table: &'a toml_edit::Table, key: &'a str) -> Result<Option<&'a ArrayOfTables>, CliError> { |
| 66 | if let Some(value) = table.get(key) { |
| 67 | if value.is_array_of_tables() { |
| 68 | Ok(value.as_array_of_tables()) |
| 69 | } else { |
| 70 | Err(CliError::ConfigType { |
| 71 | key: key.to_string(), |
| 72 | kind: "table array", |
| 73 | found: Box::new(value.clone()), |
| 74 | }) |
| 75 | } |
| 76 | } else { |
| 77 | Ok(None) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | fn read_opt_str(table: &toml_edit::Table, key: &str) -> Result<Option<String>, CliError> { |
| 82 | if let Some(value) = table.get(key) { |