summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/repo.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/repo.rs b/src/repo.rs
index ed61c28..2cc78d7 100644
--- a/src/repo.rs
+++ b/src/repo.rs
@@ -275,6 +275,12 @@ pub enum RepoCommand {
#[clap(long, short = 'R')]
remote: Option<String>,
},
+ Star {
+ repo: String,
+ },
+ Unstar {
+ repo: String,
+ },
Browse {
name: Option<String>,
#[clap(long, short = 'R')]
@@ -456,6 +462,21 @@ impl RepoCommand {
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 } => {
let repo = RepoInfo::get_current(host_name, name.as_deref(), remote.as_deref())?;
let mut url = repo.host_url().clone();