|
@@ -33,14 +33,18 @@ fn main() {
|
|
|
match matches.subcommand_name() {
|
|
|
Some("register") => if let Some(matches) = matches.subcommand_matches("register") {
|
|
|
let type_name = matches.value_of("type").unwrap().to_string();
|
|
|
- let name = matches.value_of("name").unwrap().to_string();
|
|
|
+ let location = env::current_dir().unwrap();
|
|
|
+ let location_string = location.to_str().unwrap().to_string();
|
|
|
+ let name = match matches.value_of("name") {
|
|
|
+ Some(string) => string.to_string(),
|
|
|
+ None => location.file_name().unwrap().to_str().unwrap().to_string()
|
|
|
+ };
|
|
|
let option_strings_in: Vec<&str> = matches.values_of("options").unwrap().collect();
|
|
|
let mut option_strings: Vec<String> = Vec::new();
|
|
|
for str_thing in option_strings_in {
|
|
|
option_strings.push(str_thing.to_string())
|
|
|
}
|
|
|
- let location = env::current_dir().unwrap().to_str().unwrap().to_string();
|
|
|
- repository::register(&mut configuration, &name, location, type_name, option_strings);
|
|
|
+ repository::register(&mut configuration, &name, location_string, type_name, option_strings);
|
|
|
},
|
|
|
Some("config") => if let Some(matches) = matches.subcommand_matches("config") {
|
|
|
let name = matches.value_of("name").unwrap().to_string();
|