mirror of
https://github.com/chenasraf/tblf_rust.git
synced 2026-05-18 01:49:07 +00:00
build: Makefile
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "tbl"
|
||||
name = "tblf"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
@@ -10,6 +10,6 @@ strip = true # Automatically strip symbols from the binary.
|
||||
opt-level = "z" # Optimize for size.
|
||||
lto = true # link time optimization
|
||||
codegen-units = 1 # reduce binary size
|
||||
panic = "abort" # abort on panic
|
||||
# panic = "abort" # abort on panic
|
||||
|
||||
[dependencies]
|
||||
|
||||
15
Makefile
Normal file
15
Makefile
Normal file
@@ -0,0 +1,15 @@
|
||||
build:
|
||||
cargo build --release
|
||||
build-dev:
|
||||
cargo build
|
||||
install:
|
||||
cp target/release/tblf /usr/local/bin/tblf
|
||||
install-dev:
|
||||
cp target/debug/tblf /usr/local/bin/tblf
|
||||
dev:
|
||||
make build-dev
|
||||
make install-dev
|
||||
|
||||
clean:
|
||||
cargo clean
|
||||
rm -f /usr/local/bin/tblf
|
||||
11
src/main.rs
11
src/main.rs
@@ -1,4 +1,4 @@
|
||||
use std::env;
|
||||
use std::{env,io};
|
||||
|
||||
fn main() {
|
||||
// get args
|
||||
@@ -14,7 +14,7 @@ fn main() {
|
||||
let mut collect_str = String::new();
|
||||
|
||||
// try to get from stdin
|
||||
while std::io::stdin().read_line(&mut input_str).unwrap() > 0 {
|
||||
while io::stdin().read_line(&mut input_str).unwrap() > 0 {
|
||||
collect_str.push_str(&input_str);
|
||||
input_str.clear();
|
||||
}
|
||||
@@ -40,7 +40,12 @@ fn main() {
|
||||
}
|
||||
|
||||
fn print_usage() {
|
||||
println!("Usage:\n\ttbl <string> [separator]\n\tcat <file> | tbl [separator]");
|
||||
println!("tblf ----- Format input as a table");
|
||||
println!("");
|
||||
println!("Usage:");
|
||||
println!("");
|
||||
println!(" tbl <string> [separator]");
|
||||
println!(" <piped_output> | tbl [separator]");
|
||||
}
|
||||
|
||||
fn format_as_table(input_str: &str, separator: &str, out_separator: &str) -> String {
|
||||
|
||||
Reference in New Issue
Block a user