diff --git a/Cargo.toml b/Cargo.toml index e715259..df5e165 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,4 +29,4 @@ serde_derive = "^1.0.152" walkdir = "^2.3.2" [dev-dependencies] -pretty_assertions = "1.3.0" +pretty_assertions = "^1.3.0" diff --git a/README.md b/README.md index 3557444..c336fad 100644 --- a/README.md +++ b/README.md @@ -180,9 +180,40 @@ Here's a detailed explanation of all the options you can use: How to use it: Just add this option to your command if you want to check the version. Example: mod_installer --version +### Configuring the Parser + +See the `example_config.toml` for defaults parser uses. Here we provide a brief breakdown of what each configuration does: + +Name|Category|Description|Example +----|----|:----|---- +| in_progress_words | A list of words | Checks if weidu is currently running | ["installing", "creating",] +| useful_status_words | A list of words | Provides feedback on the weidu process | ["copied", "copying",] +| choice_words | A list of words | Words which check if weidu wants user input | ["choice", "choose",] +| choice_phrase | A list of phrases | Phrases which check if weidu wants user input | ["do you want", "would you like",] +| completed_with_warnings | A single phrase | Standard phrase wiedu uses if it finishes with warning | "installed with warnings" +| failed_with_error | A single phrase | Standard phrase wiedu uses if it finishes with an error | "not installed due to errors" +| finished | A single phrase | Standard phrase wiedu uses if it finishes successfully | "successfully installed" +| eet_finished | A single phrase | A special exemption for EET for EET Core install | "process ended" + +Note: **All words/phrases are compared in lowercase ascii.** + +If you wish to changes the above; or you are using a different game language (apologies for not translating all of this); have found a exemption; or just want to change the way the parser works you'll need to create your own mod_installer.toml. + +We use the rust crate [`confy`](https://crates.io/crates/confy) to load configuration. Confy uses the rust crate [`directories`](https://crates.io/crates/directories) to find the the expected path for your operating system. The `directories` crate uses: + +- the XDG base directory and the XDG user directory specifications on Linux +- the Known Folder API on Windows +- the Standard Directories guidelines on macOS + +In order to save you some time reading all the above we will put the expected locations below: + +- Windows: `{FOLDERID_RoamingAppData}\mod_installer\config` +- Macos: `$HOME/Library/Application Support/mod_installer/config.toml` +- Linux: `$XDG_CONFIG_HOME/mod_installer/config.toml` or `$HOME/.config/mod_installer/config.toml` + ### Logging -You can make the program show more information by setting the RUST_LOG environment variable. Here are three levels you can use: +You can show more install information by setting the `RUST_LOG` environment variable. Here are some of the levels you can use: For some additional information: @@ -199,3 +230,5 @@ For absolutely everything, including WeiDU logs: ```sh RUST_LOG=TRACE mod_installer [OPTIONS] ``` + +For more information on logging visit the rust crate [`log`](https://crates.io/crates/log). diff --git a/example_parser_config.toml b/example_config.toml similarity index 100% rename from example_parser_config.toml rename to example_config.toml diff --git a/src/main.rs b/src/main.rs index f485691..e005890 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,7 +31,7 @@ fn main() -> ExitCode { " ); let args = Args::parse(); - let parser_config: Arc = match confy::load(CARGO_PKG_NAME, None) { + let parser_config: Arc = match confy::load(CARGO_PKG_NAME, "config") { Ok(config) => Arc::new(config), Err(err) => { log::error!("Internal error with config crate, {:?}", err); diff --git a/src/parser_config.rs b/src/parser_config.rs index 9003e71..744ca03 100644 --- a/src/parser_config.rs +++ b/src/parser_config.rs @@ -172,7 +172,7 @@ Example: C:\\Program Files (x86)\\BeamDog\\Games\\00806", "[N]o, [Q]uit or choos #[test] fn load_config() -> Result<(), Box> { let root = std::env::current_dir()?; - let config_path = Path::join(&root, Path::new("example_parser_config.toml")); + let config_path = Path::join(&root, Path::new("example_config.toml")); let config: ParserConfig = confy::load_path(config_path)?; let expected = ParserConfig::default(); assert_eq!(expected, config);