mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-10 03:59:31 +01:00
feat: repo delete
This commit is contained in:
parent
357dceeb78
commit
efbefd79ca
1 changed files with 21 additions and 0 deletions
21
src/repo.rs
21
src/repo.rs
|
@ -326,6 +326,9 @@ pub enum RepoCommand {
|
||||||
Unstar {
|
Unstar {
|
||||||
repo: RepoArg,
|
repo: RepoArg,
|
||||||
},
|
},
|
||||||
|
Delete {
|
||||||
|
repo: RepoArg,
|
||||||
|
},
|
||||||
Browse {
|
Browse {
|
||||||
name: Option<RepoArg>,
|
name: Option<RepoArg>,
|
||||||
#[clap(long, short = 'R')]
|
#[clap(long, short = 'R')]
|
||||||
|
@ -663,6 +666,24 @@ impl RepoCommand {
|
||||||
.await?;
|
.await?;
|
||||||
println!("Removed star from {}/{}", name.owner(), name.name());
|
println!("Removed star from {}/{}", name.owner(), name.name());
|
||||||
}
|
}
|
||||||
|
RepoCommand::Delete { repo } => {
|
||||||
|
let repo = RepoInfo::get_current(host_name, Some(&repo), None)?;
|
||||||
|
let api = keys.get_api(&repo.host_url()).await?;
|
||||||
|
let name = repo.name().unwrap();
|
||||||
|
print!(
|
||||||
|
"Are you sure you want to delete {}/{}? (y/N) ",
|
||||||
|
name.owner(),
|
||||||
|
name.name()
|
||||||
|
);
|
||||||
|
let user_response = crate::readline("").await?;
|
||||||
|
let yes = matches!(user_response.trim(), "y" | "Y" | "yes" | "Yes");
|
||||||
|
if yes {
|
||||||
|
api.repo_delete(name.owner(), name.name()).await?;
|
||||||
|
println!("Deleted {}/{}", name.owner(), name.name());
|
||||||
|
} else {
|
||||||
|
println!("Did not delete");
|
||||||
|
}
|
||||||
|
}
|
||||||
RepoCommand::Browse { name, remote } => {
|
RepoCommand::Browse { name, remote } => {
|
||||||
let repo = RepoInfo::get_current(host_name, name.as_ref(), remote.as_deref())?;
|
let repo = RepoInfo::get_current(host_name, name.as_ref(), remote.as_deref())?;
|
||||||
let mut url = repo.host_url().clone();
|
let mut url = repo.host_url().clone();
|
||||||
|
|
Loading…
Reference in a new issue