Skip to content

Commit

Permalink
Removed unused parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
cjrh committed Aug 23, 2020
1 parent b96a6e2 commit ba535c5
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/gh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,26 @@ pub fn get_repos_list(username: &str, token: &str, path: &Option<PathBuf>) {
None => std::env::current_dir().unwrap(),
};

while let Some(h) = get_repos_page(&client, &username, page, per_page) {
while let Some(h) = get_repos_page(&client, page, per_page) {
// println!("Got {} repos", &h.len());
for data in &h {
// println!("{}", serde_json::to_string_pretty(&h).unwrap());
let repo_name = data["name"].as_str().unwrap();
let ssh_url = data["ssh_url"].as_str().unwrap();
let fork: bool = data["fork"].as_bool().unwrap();
let parent_ssh_url = get_fork_parent(&client, &username, &repo_name, &fork);
clone_repo(&repo_name, &ssh_url, &fork, &write_path, parent_ssh_url);
clone_repo(&repo_name, &ssh_url, &write_path, parent_ssh_url);
}
if h.len() < per_page {
break;
}
page += 1;
}
// println!("Done.");
}

fn clone_repo(
repo_name: &str,
ssh_url: &str,
fork: &bool,
write_path: &PathBuf,
parent_ssh_url: Option<String>,
) {
Expand Down Expand Up @@ -127,12 +125,7 @@ fn get_fork_parent(
}
}

fn get_repos_page(
client: &Github,
username: &str,
page: u32,
per_page: usize,
) -> Option<Vec<Value>> {
fn get_repos_page(client: &Github, page: u32, per_page: usize) -> Option<Vec<Value>> {
let repos_endpoint = format!("user/repos?type=all&per_page={}&page={}", per_page, page);
let response = client
.get()
Expand Down

0 comments on commit ba535c5

Please sign in to comment.