Compare commits

..

No commits in common. "a3c4a5f2dd375b8b26c36cec8c4670ca50f2412b" and "f572d6d8b2cf2d5d1e2ae335c46506ec6ae6dd54" have entirely different histories.

2 changed files with 7 additions and 23 deletions

View File

@ -13,7 +13,7 @@ pub struct Config {
pub repositories: Vec<Repository>,
}
#[derive(Debug, Eq, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize)]
/// The internal representation of a single repository
pub struct Repository {
name: String,

View File

@ -1,7 +1,7 @@
pub mod config;
use config::{Config, Repository};
use std::env;
use std::error::Error;
use std::env;
#[derive(Debug)]
/// Holds the current state of the application.
@ -19,7 +19,6 @@ pub struct State {
enum Cmd {
Add,
Help,
Fetch,
DumpConfig,
}
@ -81,19 +80,10 @@ impl State {
_ => {}
},
None => {
eprintln!("No URL provided for command\n");
eprintln!("No URL provided for \'number\' command\n");
}
}
}
// fetch command
else if x == "fetch" {
match state.cmd {
None => {
state.cmd = Some(Cmd::Fetch);
}
_ => {}
}
}
arg = args.next();
}
@ -116,17 +106,11 @@ pub fn run(state: State, mut config: Config) -> Result<(), Box<dyn Error>> {
println!("{}", config.to_string().unwrap());
}
Some(Cmd::Add) => {
let repo = Repository::new(match state.url {
config.repositories.push(Repository::new(match state.url {
Some(x) => x,
None => String::new(),
});
if let None = config.repositories.iter().find(|x| **x == repo) {
config.repositories.push(repo);
config.save_config()?;
println!("Repository has been added");
} else {
println!("Repository is already being tracked");
}
}));
config.save_config()?;
}
Some(x) => {
println!("{:?} hasn't been implemented yet!", x)
@ -153,7 +137,7 @@ General
help Print out this help message
Manage Repositories
add Add another git repo to keep track of
clone Add another git repo to keep track of
fetch Update currently tracked repos"
)
}