change the config parameter to '--config', clarify about negative IDIs in the config.md documentation

This commit is contained in:
endernon 2024-11-05 21:52:51 +00:00
parent 6010d1be0d
commit d45ad9c39d
2 changed files with 6 additions and 5 deletions

View file

@ -56,6 +56,7 @@ Potential range: 0<->255.
### Other things about this
The format obeys the same json rules as the powders.
If you are trying to get the 100% or 0% roll and the value you calculated is close to 130 or 30, change it to 130 or 30 because that is the real value.
However, if the value is negative it will be between 70%-130%.
# Current issues
Crafteds are not implemented

View file

@ -22,7 +22,7 @@ use clap::Parser;
struct Args {
/// Path for config path
#[arg(short, long)]
configpath: Option<String>,
config: Option<String>,
/// Enable debug mode
#[arg(short, long, default_value_t = false)]
@ -46,13 +46,13 @@ fn cook() -> Result<(), Errorfr> {
debug_mode = true;
println!("Debug mode enabled");
};
let mut configpath: String = String::from("config.json");
if let Some(configpathargs) = args.configpath {
configpath = configpathargs;
let mut config: String = String::from("config.json");
if let Some(configpathargs) = args.config {
config = configpathargs;
}
// load configs
let json_config: Jsonconfig = serde_json::from_reader(fs::File::open(configpath)
let json_config: Jsonconfig = serde_json::from_reader(fs::File::open(config)
.map_err(|_| Errorfr::ItemJsonMissing)?)
.map_err(|e| Errorfr::ItemJsonCorrupt(e))?;
let idsmap: HashMap<String, u8> = serde_json::from_reader(fs::File::open("id_keys.json")