-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add migrate commands #2
Conversation
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
src/main.rs
Outdated
Some(Commands::Migrate { platform }) => match platform { | ||
Some(Platform::GitHub { | ||
create_repo, | ||
org, | ||
repo_name, | ||
reset, | ||
}) => { | ||
let url = format!("git@github.com:{}/{}.git", org, repo_name); | ||
|
||
if *create_repo { | ||
let token = get_gh_auth_token(*reset).unwrap_or_default(); | ||
println!("Token: {}", token) | ||
} | ||
|
||
let repo = Repository::open(".").unwrap(); | ||
match repo.remote_set_url("origin", &url) { | ||
Ok(_) => { | ||
println!("New remote URL set.") | ||
} | ||
Err(_) => { | ||
println!("Failed to set new remote URL.") | ||
} | ||
} | ||
|
||
println!("Reconfigure current repository to new repo") | ||
} | ||
None => {} | ||
}, |
Check warning
Code scanning / clippy
this match can be collapsed into the outer match Warning
io::stdin().read_line(&mut buffer).unwrap(); | ||
|
||
entry.set_password(&buffer.trim())?; | ||
Ok(entry.get_password()?) |
Check warning
Code scanning / clippy
question mark operator is useless here Warning
match entry.get_password() { | ||
Ok(p) => { | ||
if reset { | ||
return Ok(write_gh_auth_token(entry)?); |
Check warning
Code scanning / clippy
question mark operator is useless here Warning
let mut callbacks = RemoteCallbacks::new(); | ||
|
||
callbacks.credentials(|_url, _username_from_url, _allowed_types| { | ||
Cred::ssh_key_from_agent("git").map_err(|e| e.into()) |
Check warning
Code scanning / clippy
useless conversion to the same type: git2::Error Warning
What's been changed?
If there's a ticket, please share below too.
migrate
command