Skip to content

Commit 5d304f2

Browse files
committed
Rename search option to find
1 parent 5ed68f8 commit 5d304f2

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/main.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct Column<'a> {
3939
value: RefCell<String>,
4040
attr: Option<&'a str>,
4141
convert: Option<&'a str>,
42-
search: Option<&'a str>,
42+
find: Option<&'a str>,
4343
replace: Option<&'a str>,
4444
consol: Option<&'a str>,
4545
subtable: Option<Table<'a>>
@@ -97,7 +97,7 @@ fn gml_to_ewkb(cell: &RefCell<String>, geom: &Geometry) {
9797
}
9898
}
9999

100-
fn add_table<'a>(rowpath: &str, outfile: Option<&str>, colspec: &'a Vec<Yaml>) -> Table<'a> {
100+
fn add_table<'a>(rowpath: &str, outfile: Option<&str>, colspec: &'a [Yaml]) -> Table<'a> {
101101
let mut table = Table::new(rowpath, outfile);
102102
for col in colspec {
103103
let name = col["name"].as_str().expect("Column has no 'name' entry in configuration file");
@@ -112,11 +112,11 @@ fn add_table<'a>(rowpath: &str, outfile: Option<&str>, colspec: &'a Vec<Yaml>) -
112112
}
113113
};
114114
let attr = col["attr"].as_str();
115-
let convert = col["convert"].as_str();
116-
let search = col["search"].as_str();
117-
let replace = col["replace"].as_str();
118-
let consol = col["consol"].as_str();
119-
let column = Column { name: name.to_string(), path, value: RefCell::new(String::new()), attr, convert, search, replace, consol, subtable };
115+
let convert = col["conv"].as_str();
116+
let find = col["find"].as_str();
117+
let replace = col["repl"].as_str();
118+
let consol = col["cons"].as_str();
119+
let column = Column { name: name.to_string(), path, value: RefCell::new(String::new()), attr, convert, find, replace, consol, subtable };
120120
table.columns.push(column);
121121
}
122122
table
@@ -144,8 +144,8 @@ fn main() -> std::io::Result<()> {
144144
let mut buf = Vec::new();
145145
let mut count = 0;
146146

147-
let rowpath = config["path"].as_str().expect("No valid 'rowpath' entry in configuration file");
148-
let colspec = config["cols"].as_vec().expect("No valid 'columns' array in configuration file");
147+
let rowpath = config["path"].as_str().expect("No valid 'path' entry in configuration file");
148+
let colspec = config["cols"].as_vec().expect("No valid 'cols' array in configuration file");
149149
let outfile = config["file"].as_str();
150150
let maintable = add_table(rowpath, outfile, colspec);
151151
let mut tables: Vec<&Table> = Vec::new();
@@ -299,7 +299,7 @@ fn main() -> std::io::Result<()> {
299299
if i > 0 { table.write("\t"); }
300300
if table.columns[i].value.borrow().is_empty() { table.write("\\N"); }
301301
else {
302-
if let (Some(s), Some(r)) = (table.columns[i].search, table.columns[i].replace) {
302+
if let (Some(s), Some(r)) = (table.columns[i].find, table.columns[i].replace) {
303303
let mut value = table.columns[i].value.borrow_mut();
304304
*value = value.replace(s, r);
305305
}
@@ -317,7 +317,7 @@ fn main() -> std::io::Result<()> {
317317
for i in 0..table.columns.len() {
318318
if path == table.columns[i].path {
319319
xmltotext = false;
320-
if let (Some(s), Some(r)) = (table.columns[i].search, table.columns[i].replace) {
320+
if let (Some(s), Some(r)) = (table.columns[i].find, table.columns[i].replace) {
321321
text = text.replace(s, r);
322322
}
323323
table.columns[i].value.borrow_mut().push_str(&text);

0 commit comments

Comments
 (0)