Skip to content

Commit

Permalink
Set gen default dynamically.
Browse files Browse the repository at this point in the history
  • Loading branch information
est357 committed Dec 22, 2021
1 parent 088453d commit e79dd93
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/process_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn process_args() -> (u32, u32, u8, u64, u8, char) {
None => 200,
};
let width_default = cols.to_string();
let initial_bit_default = (cols / 2).to_string();
let init_bit_or_gen_default = (cols / 2).to_string();

let app = App::new("ca-term")
.setting(AppSettings::ArgRequiredElseHelp)
Expand All @@ -30,7 +30,7 @@ pub fn process_args() -> (u32, u32, u8, u64, u8, char) {
.help("How many lines it should generate. Number value.")
.short("g")
.long("generations")
.default_value("100"),
.default_value(&init_bit_or_gen_default),
Arg::with_name("rule")
.help("The CA rule number according to https://mathworld.wolfram.com/ElementaryCellularAutomaton.html. Number value.")
.short("r")
Expand All @@ -45,7 +45,7 @@ pub fn process_args() -> (u32, u32, u8, u64, u8, char) {
.help("Initial bit 1 position. Between 0 and width value. Number value.")
.short("b")
.long("init_bit")
.default_value(&initial_bit_default),
.default_value(&init_bit_or_gen_default),
Arg::with_name("display_character")
.help("The character with which it will be drawn. Just 1 character.")
.short("c")
Expand Down

0 comments on commit e79dd93

Please sign in to comment.