Skip to content

Commit

Permalink
Give --module and --businessobject flags priority
Browse files Browse the repository at this point in the history
  • Loading branch information
nithinphilips committed Sep 3, 2024
1 parent 978ed61 commit 6b15df3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions ChangeLog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion odel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "odel"
version = "1.3.0"
version = "1.3.1"
authors = ["Nithin Philips <[email protected]>"]
edition = "2018"
license = "GPLv3"
Expand Down
28 changes: 13 additions & 15 deletions odel/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,30 +399,28 @@ 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
},
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);
}
Expand Down

0 comments on commit 6b15df3

Please sign in to comment.