File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/target
2+ * .tar.gz
Original file line number Diff line number Diff line change 11[package ]
22name = " git-b"
3- version = " 0.1 .0"
3+ version = " 1.0 .0"
44edition = " 2021"
55
66# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77
88[dependencies ]
99skim = " 0.9.4"
10+
11+ [profile .release ]
12+ lto = true
13+ codegen-units = 1
14+ opt-level = " z"
15+ strip = true
Original file line number Diff line number Diff line change 1+
2+ VERSION = '1.0.0'
3+ X86_64_SHA = '7c84096e7578411f9226e75a96df79c134eca2c8eddd7b452b609263cc6e243e'
4+ AARCH64_SHA = '191748a0e2f0d582d1f7c9c054b2a7a90daeb923ac9806df8e42d692b637adfa'
5+
6+
7+ class GitB < Formula
8+ desc "Git B"
9+ homepage "https://github.com/jharrilim/git-b"
10+ version VERSION
11+
12+ on_macos do
13+ if Hardware ::CPU . intel?
14+ url "https://github.com/jharrilim/git-b/releases/download/v#{ VERSION } /git-b-v#{ VERSION } -x86_64-apple-darwin.tar.gz"
15+ sha256 X86_64_SHA
16+ else
17+ url "https://github.com/jharrilim/git-b/releases/download/v#{ VERSION } /git-b-v#{ VERSION } -aarch64-apple-darwin.tar.gz"
18+ sha256 AARCH64_SHA
19+ end
20+ end
21+
22+ def install
23+ bin . install "git-b"
24+ end
25+
26+ test do
27+ system bin / "git-b" , "--version"
28+ end
29+ end
Original file line number Diff line number Diff line change 11# git b
22
33Fuzzy selector for git branches
4+
5+ ## Install (Mac)
6+
7+ ``` sh
8+ brew tap jharrilim/git-b/git-b
9+ brew install git-b
10+ ```
11+
12+ ## Compiling from Mac to Linux
13+
14+ Due to [ rust/issues/34282] ( https://github.com/rust-lang/rust/issues/34282 ) , you'll need to run this
15+ before running the ` build ` script:
16+
17+ ``` sh
18+ brew tap SergioBenitez/osxct
19+ brew install x86_64-unknown-linux-gnu
20+ ```
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e
4+
5+ name=" git-b"
6+ version=" $1 "
7+
8+ mac_intel=" x86_64-apple-darwin"
9+ mac_silicon=" aarch64-apple-darwin"
10+ linux_intel=" x86_64-unknown-linux-gnu"
11+
12+ mac_intel_tar=" $name -$version -$mac_intel .tar.gz"
13+ mac_silicon_tar=" $name -v$version -$mac_silicon .tar.gz"
14+ linux_intel_tar=" $name -v$version -$linux_intel .tar.gz"
15+
16+ cargo build --target=$mac_intel --release
17+ cargo build --target=$mac_silicon --release
18+ CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-unknown-linux-gnu-gcc cargo build --target=$linux_intel --release
19+
20+ cd target/$mac_silicon /release
21+ tar -czvf " $mac_silicon_tar " $name
22+ silicon_sha=$( shasum -a 256 " $mac_silicon_tar " | cut -d ' ' -f 1)
23+ mv " $mac_silicon_tar " ../../../" $mac_silicon_tar "
24+
25+ cd ../../$mac_intel /release
26+ tar -czvf " $mac_intel_tar " $name
27+ intel_sha=$( shasum -a 256 " $mac_intel_tar " | cut -d ' ' -f 1)
28+ mv " $mac_intel_tar " ../../../" $mac_intel_tar "
29+
30+ cd ../../$linux_intel /release
31+ tar -czvf " $linux_intel_tar " $name
32+ mv " $linux_intel_tar " ../../../" $linux_intel_tar "
33+
34+ cd ../../../
35+
36+ sed -i ' ' -e " s|X86_64_SHA\ \=.*|X86_64_SHA = '$intel_sha '|" Formula/git_b.rb
37+ sed -i ' ' -e " s|AARCH64_SHA\ \=.*|AARCH64_SHA = '$silicon_sha '|" Formula/git_b.rb
38+ sed -i ' ' -e " s|VERSION\ \=.*|VERSION = '$version '|" Formula/git_b.rb
Original file line number Diff line number Diff line change @@ -2,6 +2,11 @@ use skim::prelude::*;
22use std:: { io:: BufReader , process:: Command } ;
33
44fn main ( ) {
5+ if std:: env:: args ( ) . any ( |arg| arg == "--version" ) {
6+ println ! ( "git-b {}" , env!( "CARGO_PKG_VERSION" ) ) ;
7+ return ;
8+ }
9+
510 let branches = branch_names ( ) . join ( "\n " ) ;
611 let b = Box :: leak ( branches. into_boxed_str ( ) ) ;
712 let reader = BufReader :: new ( b. as_bytes ( ) ) ;
You can’t perform that action at this time.
0 commit comments