Skip to content

Commit

Permalink
fix: Use binary name
Browse files Browse the repository at this point in the history
  • Loading branch information
DashieTM committed Mar 21, 2024
1 parent af4d4e4 commit fb12ac3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "re_set-lib"
version = "2.5.2"
version = "2.5.3"
edition = "2021"
description = "Data structure library for ReSet"
repository = "https://github.com/Xetibo/ReSet-Lib"
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub fn create_config(project_organization: &str, project_name: &str) -> Option<P
pub fn parse_flags(flags: &[String]) -> Flags {
let mut parsed_flags = Flags(Vec::new());
let mut iter = flags.iter();
iter.next().expect("Did not recieve a binary name!");
loop {
let next = iter.next();
if next.is_none() {
Expand Down
11 changes: 6 additions & 5 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ fn test_parameters() {
use std::fs;

fs::File::create_new("test.txt").expect("Could not create test file");
let command_flags = vec![String::from("--config"), String::from("test.txt")];
let command_flags = vec![
String::from("binary name"),
String::from("--config"),
String::from("test.txt"),
];
let flags = parse_flags(&command_flags);
assert!(!flags.0.is_empty());
assert_eq!(
flags,
Flags(vec![Flag::ConfigDir(&"test.txt".to_string())])
);
assert_eq!(flags, Flags(vec![Flag::ConfigDir(&"test.txt".to_string())]));
fs::remove_file("test.txt").expect("Could not delete test file");
}

0 comments on commit fb12ac3

Please sign in to comment.