-
Notifications
You must be signed in to change notification settings - Fork 1
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
7 changed files
with
53 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# To be used together with a bazel WORKSPACE file that contains the following definitions. | ||
load("@committer_crate//:defs.bzl", "all_crate_deps") | ||
load("@rules_rust//rust:defs.bzl", "rust_binary") | ||
|
||
rust_binary( | ||
name="committer_exe", | ||
srcs=glob(["src/**/*.rs"]), | ||
visibility=["//visibility:public"], | ||
deps=all_crate_deps(), | ||
proc_macro_deps=all_crate_deps(proc_macro=True), | ||
edition="2021", | ||
) |
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,13 @@ | ||
[package] | ||
name = "committer_cli" | ||
version.workspace = true | ||
edition.workspace = true | ||
repository.workspace = true | ||
license-file.workspace = true | ||
description = "Cli for the committer package." | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[dev-dependencies] | ||
pretty_assertions.workspace = true |
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,20 @@ | ||
use std::env; | ||
use std::path::Path; | ||
|
||
/// Main entry point of the committer CLI. | ||
fn main() { | ||
// Open the input file. | ||
let args: Vec<String> = env::args().collect(); | ||
let input_file_name = Path::new(&args[1]); | ||
let output_file_name = Path::new(&args[2]); | ||
assert!( | ||
input_file_name.is_absolute() && output_file_name.is_absolute(), | ||
"Given paths must be absolute" | ||
); | ||
|
||
// Business logic to be implemented here. | ||
let output = std::fs::read(input_file_name).unwrap(); | ||
|
||
// Output to file. | ||
std::fs::write(output_file_name, output).expect("Failed to write output"); | ||
} |