Skip to content

Commit

Permalink
feat: Add push latest flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamd3vil committed May 19, 2022
1 parent 9f68474 commit 036ba54
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/lib.rs
Expand Up @@ -93,6 +93,12 @@ pub fn bump(b: &Bump) -> Result<()> {
Ok(())
}

pub fn push_latest() -> Result<String> {
let latest_tag = get_latest_tag()?;
let result = run(&format!("git push origin {}", latest_tag))?;
Ok(result)
}

pub fn init() -> Result<()> {
// Check if there's already a tag.
if let Ok(tag) = get_latest_tag() {
Expand Down
8 changes: 7 additions & 1 deletion src/main.rs
@@ -1,7 +1,7 @@
use anyhow::Result;
use gumdrop::Options;
use std::{env, process};
use verbump::{bump, get_all_tags, get_latest_tag, init, Bump};
use verbump::{bump, get_all_tags, get_latest_tag, init, push_latest, Bump};

#[derive(Options, Debug)]
struct Args {
Expand Down Expand Up @@ -39,6 +39,12 @@ fn main() {
let latest_tag = handle_error(get_latest_tag());
println!("{}", latest_tag);
}
Args {
push_latest: true, ..
} => {
handle_error(push_latest());
println!("pushed latest tag");
}
Args { init: true, .. } => {
handle_error(init());
}
Expand Down

0 comments on commit 036ba54

Please sign in to comment.