Skip to content

Commit

Permalink
feat: open pr in browser (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlienard authored Apr 11, 2024
1 parent fc17ec9 commit 9d7c30e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
37 changes: 37 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition = "2021"
colored = "2"
home = "0.5.9"
inquire = { version = "0.6.2", features = ["editor"] }
open = "5.1.2"
reqwest = { version = "0.11", features = ["json"] }
serde_json = "1.0"
tokio = { version = "1", features = ["full"] }
11 changes: 7 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ async fn pr_command() -> Result<(), Box<dyn Error>> {
let gh = Github::new(&github_token);

let pr_url = gh.create_pr(config).await?;
let pr_url = pr_url.replace('"', "");
println!("{}", "✔ Pull request created.".green());

let username = gh.get_username().await?;
Expand All @@ -63,9 +64,11 @@ async fn pr_command() -> Result<(), Box<dyn Error>> {

println!(
"🎉 Success! The pull request url is: {}",
pr_url.replace('"', "").bright_cyan()
pr_url.bright_cyan()
);

open::that(pr_url)?;

Ok(())
}

Expand Down Expand Up @@ -123,14 +126,14 @@ fn help_command() {
println!(" ghl [command]");
println!();
println!("{}", "Commands".bold());
println!(" help Display this message.");
println!(" config Set the GitHub token and the default pull request description.");
println!(" create, -c Do the following:");
println!(" help Display this message.");
println!(" pr Do the following:");
println!(" 1. Create a new branch.");
println!(" 2. Create a new commit.");
println!(" 3. Push to the remote repository.");
println!(" 4. Create a new pull request.");
println!(" 5. Assign you the pull request.");
println!(" version, -v Display the current and the latest version.");
println!(" update, -up Update the binary to the latest version.");
println!(" version, -v Display the current and the latest version.");
}

0 comments on commit 9d7c30e

Please sign in to comment.