-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
46 additions
and
232 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub fn read() -> String { | ||
todo!() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use std::process::Command; | ||
|
||
pub fn co(branch: &str) { | ||
let status = | ||
Command::new("git") | ||
.arg("checkout") | ||
.arg(branch) | ||
.status() | ||
.expect("failed to find git"); | ||
assert!(status.success()) | ||
} | ||
|
||
pub fn current_branch() -> String { | ||
let output = | ||
Command::new("git") | ||
.arg("branch") | ||
.arg("--show-current") | ||
.output() | ||
.expect("failed to find git") | ||
.stdout; | ||
String::from_utf8(output).expect("failed to find current branch") | ||
} | ||
|
||
pub fn diff(from: &str, into: &str) -> String { | ||
todo!() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
use clap::Parser; | ||
use std::env::args; | ||
|
||
#[derive(Parser, Debug)] | ||
#[command(version, about, long_about = None)] | ||
struct Args { | ||
#[arg(short, long)] | ||
from_branch: String, | ||
use clap::Parser; | ||
|
||
#[arg(short, long)] | ||
into_branch: String, | ||
} | ||
mod git; | ||
mod arch; | ||
|
||
fn main() { | ||
let Args { from_branch, into_branch } = Args::parse(); | ||
let from_arch = read_arch(from_branch); | ||
let into_arch = read_arch(into_branch); | ||
let arch_diff = git_diff(from_arch, into_arch); | ||
println!("{}", arch_diff); | ||
let from_branch = args().nth(1).expect("expected source branch name"); | ||
let into_branch = git::current_branch(); | ||
|
||
git::co(&from_branch); | ||
let from_branch = arch::read(); | ||
|
||
git::co(&into_branch); | ||
let into_branch = arch::read(); | ||
|
||
println!("{}", git::diff(&from_branch, &into_branch)); | ||
} |