diff --git a/Cargo.lock b/Cargo.lock index 203a4e0..2d1c18f 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -1182,7 +1182,7 @@ checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" [[package]] name = "odel" -version = "1.3.0" +version = "1.3.1" dependencies = [ "anyhow", "async-recursion", @@ -1996,9 +1996,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.2.0" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ "winapi-util", ] diff --git a/ChangeLog.rst b/ChangeLog.rst index dc273ec..04c1e97 100755 --- a/ChangeLog.rst +++ b/ChangeLog.rst @@ -2,6 +2,12 @@ Change Log ========== Odel Change Log +v1.3.1 +------ +* Fix: If both ``--module`` and ``--businessobject`` CLI flags are set, do not + parse the file name, even if it's parseable. Use the user specified values + instead. + v1.3.0 ------ * Enhanced support for 4.x TRIRIGA. diff --git a/odel/Cargo.toml b/odel/Cargo.toml index a3e3ab9..d2b9c15 100755 --- a/odel/Cargo.toml +++ b/odel/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "odel" -version = "1.3.0" +version = "1.3.1" authors = ["Nithin Philips "] edition = "2018" license = "GPLv3" diff --git a/odel/src/main.rs b/odel/src/main.rs index b09455e..12f5136 100755 --- a/odel/src/main.rs +++ b/odel/src/main.rs @@ -399,23 +399,13 @@ fn parse_trim_files(files: &[&str], .file_name().ok_or_else(|| anyhow!("Error reading path"))? .to_str().ok_or_else(|| anyhow!("Error reading path"))?; + // This is not correct. + // If --module and --businessobject CLI flags are specified, we must not parse. let fc = - if let Some(mut fcc) = parse_filename(data_file) { - fcc.trimmed_filename = file_trim_strategy(file_name_only, FILE_NAME_MAX_LEN); - fcc - } else { + if module.is_some() && business_object.is_some() { FileComponents { - module: module - .ok_or_else (|| anyhow!("The object type information could not be extracted \ - from file name `{}`. Specify it using --module, --businessobject and \ - (optionally) --form.", - data_file))? - .to_string(), - business_object: business_object - .ok_or_else(|| anyhow!("The object type information could not be extracted \ - from file name `{}`. Specify it using --module, --businessobject and \ - (optionally) --form.", data_file))? - .to_string(), + module: String::from(module.unwrap()), + business_object: String::from(business_object.unwrap()), form: match form { Some(s) => Some(s.to_string()), None => None @@ -423,6 +413,14 @@ fn parse_trim_files(files: &[&str], filename: data_file.to_string(), trimmed_filename: file_trim_strategy(file_name_only, FILE_NAME_MAX_LEN) } + } else if let Some(mut fcc) = parse_filename(data_file) { + fcc.trimmed_filename = file_trim_strategy(file_name_only, FILE_NAME_MAX_LEN); + fcc + } else { + bail!("The object type information could not be extracted \ + from file name `{}`. Specify it using --module, --businessobject and \ + (optionally) --form.", + data_file); }; result.push(fc); }