Projects STRLCPY cfonts Commits 2b112b0a
🤬
  • ■ ■ ■ ■
    rust/Cargo.lock
    skipped 20 lines
    21 21   
    22 22  [[package]]
    23 23  name = "cfonts"
    24  -version = "1.0.1"
     24 +version = "1.0.2"
    25 25  dependencies = [
    26 26   "enable-ansi-support",
    27 27   "exitcode",
    skipped 265 lines
  • ■ ■ ■ ■
    rust/Cargo.toml
    1 1  [package]
    2 2  name = "cfonts"
    3  -version = "1.0.1"
     3 +version = "1.0.2"
    4 4  edition = "2021"
    5 5  authors = ["Dominik Wilkowski <[email protected]>"]
    6 6  license = "GPL-3.0-or-later"
    skipped 23 lines
  • ■ ■ ■ ■ ■
    rust/README.md
    skipped 133 lines
    134 134   
    135 135  ## Release History
    136 136   
     137 +* 1.0.2 - Fixed help and version flags in first position
    137 138  * 1.0.1 - Fixed font loading
    138 139  * 1.0.0 - Public release of rust API
    139 140  * 0.1.0 - alpha test
    skipped 7 lines
  • ■ ■ ■ ■ ■ ■
    rust/src/args.rs
    skipped 171 lines
    172 172   ));
    173 173   }
    174 174   
     175 + let version_options = options_lookup.get("-v").unwrap();
     176 + if my_args[1] == *version_options.shortcut.to_string()
     177 + || my_args[1] == *version_options.name.to_string()
     178 + || my_args[1] == *version_options.fallback_shortcut.to_string()
     179 + {
     180 + options.version = true;
     181 + }
     182 + 
     183 + let help_options = options_lookup.get("-h").unwrap();
     184 + if my_args[1] == *help_options.shortcut.to_string() || my_args[1] == *help_options.name.to_string() {
     185 + options.help = true;
     186 + }
     187 + 
    175 188   // our text to be converted
    176 189   options.text = my_args[1].clone();
    177 190   
    skipped 340 lines
  • ■ ■ ■ ■ ■ ■
    rust/tests/args_test.rs
    skipped 90 lines
    91 91   }
    92 92   
    93 93   #[test]
     94 + fn args_parse_version_flags() {
     95 + let mut options = Options::default();
     96 + options.version = true;
     97 + options.text = String::from("-v");
     98 + assert_eq!(parse(vec!["path/to/bin".to_string(), "-v".to_string()]).unwrap(), options);
     99 + options.text = String::from("-V");
     100 + assert_eq!(parse(vec!["path/to/bin".to_string(), "-V".to_string()]).unwrap(), options);
     101 + options.text = String::from("--version");
     102 + assert_eq!(parse(vec!["path/to/bin".to_string(), "--version".to_string()]).unwrap(), options);
     103 + }
     104 + 
     105 + #[test]
     106 + fn args_parse_help_flags() {
     107 + let mut options = Options::default();
     108 + options.help = true;
     109 + options.text = String::from("-h");
     110 + assert_eq!(parse(vec!["path/to/bin".to_string(), "-h".to_string()]).unwrap(), options);
     111 + options.text = String::from("--help");
     112 + assert_eq!(parse(vec!["path/to/bin".to_string(), "--help".to_string()]).unwrap(), options);
     113 + }
     114 + 
     115 + #[test]
    94 116   fn args_parse_boolean_flags() {
    95 117   let mut options = Options::default();
    96 118   options.text = String::from("my text");
    skipped 1723 lines
Please wait...
Page is in error, reload to recover