Skip to content
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

Merged
merged 12 commits into from
Oct 21, 2024
Merged

feat: add migrate commands #2

merged 12 commits into from
Oct 21, 2024

Conversation

tofuuudon
Copy link
Contributor

What's been changed?

If there's a ticket, please share below too.

  • Add migrate command

@tofuuudon tofuuudon self-assigned this Oct 19, 2024
@github-actions github-actions bot added source Main source code, e.g. src directory size/l labels Oct 19, 2024
@github-actions github-actions bot added size/xl and removed size/l labels Oct 20, 2024
@github-actions github-actions bot added size/l and removed size/xl labels Oct 21, 2024
@github-actions github-actions bot added the ci Git and CI/CD configurations label Oct 21, 2024
@github-advanced-security
Copy link

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
Comment on lines 43 to 70
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

this match can be collapsed into the outer match
src/modules/remote.rs Fixed Show fixed Hide fixed
src/modules/remote.rs Fixed Show fixed Hide fixed
@github-actions github-actions bot added size/xl and removed size/l labels Oct 21, 2024
src/modules/remote.rs Fixed Show fixed Hide fixed
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

question mark operator is useless here
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

question mark operator is useless here
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

useless conversion to the same type: git2::Error
@tofuuudon tofuuudon merged commit e1b4573 into main Oct 21, 2024
4 checks passed
@tofuuudon tofuuudon deleted the feat/add-migrate-command branch October 21, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Git and CI/CD configurations size/xl source Main source code, e.g. src directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant