mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-10 12:09:33 +01:00
add repo star
and repo unstar
This commit is contained in:
parent
a259a44eca
commit
6687c9e2c1
1 changed files with 21 additions and 0 deletions
21
src/repo.rs
21
src/repo.rs
|
@ -275,6 +275,12 @@ pub enum RepoCommand {
|
||||||
#[clap(long, short = 'R')]
|
#[clap(long, short = 'R')]
|
||||||
remote: Option<String>,
|
remote: Option<String>,
|
||||||
},
|
},
|
||||||
|
Star {
|
||||||
|
repo: String,
|
||||||
|
},
|
||||||
|
Unstar {
|
||||||
|
repo: String,
|
||||||
|
},
|
||||||
Browse {
|
Browse {
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
#[clap(long, short = 'R')]
|
#[clap(long, short = 'R')]
|
||||||
|
@ -456,6 +462,21 @@ impl RepoCommand {
|
||||||
println!("View online at {html_url}");
|
println!("View online at {html_url}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RepoCommand::Star { repo } => {
|
||||||
|
let repo = RepoInfo::get_current(host_name, Some(&repo), None)?;
|
||||||
|
let api = keys.get_api(&repo.host_url())?;
|
||||||
|
let name = repo.name().unwrap();
|
||||||
|
api.user_current_put_star(name.owner(), name.name()).await?;
|
||||||
|
println!("Starred {}/{}!", name.owner(), name.name());
|
||||||
|
}
|
||||||
|
RepoCommand::Unstar { repo } => {
|
||||||
|
let repo = RepoInfo::get_current(host_name, Some(&repo), None)?;
|
||||||
|
let api = keys.get_api(&repo.host_url())?;
|
||||||
|
let name = repo.name().unwrap();
|
||||||
|
api.user_current_delete_star(name.owner(), name.name())
|
||||||
|
.await?;
|
||||||
|
println!("Removed star from {}/{}", name.owner(), name.name());
|
||||||
|
}
|
||||||
RepoCommand::Browse { name, remote } => {
|
RepoCommand::Browse { name, remote } => {
|
||||||
let repo = RepoInfo::get_current(host_name, name.as_deref(), remote.as_deref())?;
|
let repo = RepoInfo::get_current(host_name, name.as_deref(), remote.as_deref())?;
|
||||||
let mut url = repo.host_url().clone();
|
let mut url = repo.host_url().clone();
|
||||||
|
|
Loading…
Reference in a new issue