Skip to content

Commit

Permalink
Binary size improvement, update dependencies, update rust toolchain (#12
Browse files Browse the repository at this point in the history
)

* Split debug info and bump version

* Use rust 1.67.1 in CI

* Add rust-toolchain

* Upgrade dependencies

* Fix clippy lints
  • Loading branch information
oren0e authored Feb 19, 2023
1 parent 5dd38a2 commit 0299ac2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 24 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
name: Rust ${{matrix.rust}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@1.51.0
with:
components: clippy, rustfmt
- name: Print rust version
run: rustup show
- name: Print clippy version
run: cargo clippy --version
- name: Lint
run: make lint
- name: Run tests
run: make test
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@1.67.1
with:
components: clippy, rustfmt
- name: Print rust version
run: rustup show
- name: Print clippy version
run: cargo clippy --version
- name: Lint
run: make lint
- name: Run tests
run: make test
14 changes: 10 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gitopen"
version = "1.3.2"
version = "1.3.3"
authors = ["Oren Epshtain"]
edition = "2018"
license-file = "LICENSE"
Expand All @@ -18,7 +18,13 @@ exclude = [".github/*", ".gitignore"]


[dependencies]
webbrowser = "0.5.5"
anyhow = "1.0.44"
regex = "1.6.0"
webbrowser = "0.8.7"
anyhow = "1.0.69"
regex = "1.7.1"
clap = "2.33.3"

[profile.dev]
split-debuginfo = "unpacked"

[profile.release]
split-debuginfo = "unpacked"
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
profile = "default"
channel = "1.67.1"
6 changes: 3 additions & 3 deletions src/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::process::{Command, Stdio};
// TODO: Add caching (`cached` crate)
fn get_parsed_url() -> AnyhowResult<String> {
let git_repo = Command::new("git")
.args(&["config", "--get", "remote.origin.url"])
.args(["config", "--get", "remote.origin.url"])
.stdout(Stdio::piped())
.output()?;

Expand Down Expand Up @@ -45,13 +45,13 @@ pub fn open_at_line_number(input: &str) -> AnyhowResult<()> {

pub fn push_and_open_pr() -> AnyhowResult<()> {
let current_branch = Command::new("git")
.args(&["branch", "--show-current"])
.args(["branch", "--show-current"])
.stdout(Stdio::piped())
.output()?;
let current_branch_text = &String::from_utf8(current_branch.stdout)?;
let current_branch_text_stripped = current_branch_text.trim();
let output_from_push = Command::new("git")
.args(&["push", "origin", current_branch_text_stripped])
.args(["push", "origin", current_branch_text_stripped])
.stderr(Stdio::piped())
.output()?;
let pr_re = Regex::new(r"remote:.*(https\S*)\s*\n")?;
Expand Down
8 changes: 3 additions & 5 deletions src/match_logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ pub fn parse_url_from_git(s: &str) -> AnyhowResult<String> {
.captures(&url_parts[1])
.ok_or_else(|| anyhow!("Regex error capturing ssh domain"))?;

let result: String = "https://".to_string()
+ &match_domain[1].to_string()
+ r"/"
+ remove_git_suffix(&url_parts[7]);
let result: String =
"https://".to_string() + &match_domain[1] + r"/" + remove_git_suffix(&url_parts[7]);
Ok(result)
}

Expand Down Expand Up @@ -83,7 +81,7 @@ pub fn parse_path_and_line_arg(arg: &str, split_char: char) -> AnyhowResult<File

fn get_current_branch_name() -> AnyhowResult<String> {
let git_branch = Command::new("git")
.args(&["symbolic-ref", "--short", "HEAD"])
.args(["symbolic-ref", "--short", "HEAD"])
.stdout(Stdio::piped())
.output()?;
let stdout = String::from_utf8(git_branch.stdout)?.trim_end().to_string();
Expand Down

0 comments on commit 0299ac2

Please sign in to comment.