summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulian Sitkevich <1553398+sitkevij@users.noreply.github.com>2020-11-21 13:07:30 -0800
committerGitHub <noreply@github.com>2020-11-21 13:07:30 -0800
commit39589d50d0f564a6fc0e26e86dbdea693a8bf400 (patch)
tree2c9f26333c5d37bb05be2d7ab1386f5f1ac6970a
parent0f46232ac1af1c792d4f5b74e80e5fed07d8e4fb (diff)
parent4acf227f5cc48304c42b8842ca4d4d03fda72b0a (diff)
Merge pull request #49 from sitkevij/feature/isatty
#48 feature/isatty
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.md17
-rw-r--r--.github/workflows/ci.yml7
-rw-r--r--.gitignore3
-rw-r--r--Cargo.lock120
-rw-r--r--Cargo.toml10
-rw-r--r--Makefile23
-rw-r--r--README.md6
-rw-r--r--src/lib.rs27
-rw-r--r--src/main.rs6
9 files changed, 133 insertions, 86 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index dd84ea7..3205926 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -12,6 +12,7 @@ A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
+
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
@@ -24,15 +25,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- - OS: [e.g. iOS]
- - Browser [e.g. chrome, safari]
- - Version [e.g. 22]
+
+- OS: [e.g. iOS]
+- Browser [e.g. chrome, safari]
+- Version [e.g. 22]
**Smartphone (please complete the following information):**
- - Device: [e.g. iPhone6]
- - OS: [e.g. iOS8.1]
- - Browser [e.g. stock browser, safari]
- - Version [e.g. 22]
+
+- Device: [e.g. iPhone6]
+- OS: [e.g. iOS8.1]
+- Browser [e.g. stock browser, safari]
+- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e4cd193..058100b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,6 +1,10 @@
name: CI
on:
pull_request:
+ branches:
+ - develop
+ - main
+ - master
push:
branches:
- develop
@@ -36,10 +40,11 @@ jobs:
- run: cargo test --verbose --all -- --nocapture
- run: cargo install hyperfine
- run: echo "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." | target/release/hx
- - run: hyperfine --warmup 20 "echo 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' | target/release/hx"
+ - run: hyperfine -i --warmup 20 "echo 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' | target/release/hx"
# - run: cargo test --verbose --all -- --nocapture
# - run: cargo test --verbose --workspace --all-features
# - run: cargo test --verbose --workspace --no-default-features
+ # see https://github.com/actions/upload-release-asset
clippy:
name: Lint with clippy
diff --git a/.gitignore b/.gitignore
index e87a0b4..91a6361 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,4 +13,5 @@
# ci code coverage
tarpaulin-report.html
-cobertura.xml \ No newline at end of file
+cobertura.xml
+trend.svg \ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
index 6819a49..d69a29f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4,197 +4,203 @@
name = "ansi_term"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
dependencies = [
- "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi",
]
[[package]]
name = "assert_cmd"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c88b9ca26f9c16ec830350d309397e74ee9abdfd8eb1f71cb6ecc71a3fc818da"
dependencies = [
- "doc-comment 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "predicates 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "wait-timeout 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "doc-comment",
+ "predicates",
+ "predicates-core",
+ "predicates-tree",
+ "wait-timeout",
]
[[package]]
name = "atty"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
dependencies = [
- "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
- "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc",
+ "termion",
+ "winapi",
]
[[package]]
name = "bitflags"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
[[package]]
name = "clap"
version = "2.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
dependencies = [
- "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ansi_term",
+ "atty",
+ "bitflags",
+ "strsim",
+ "textwrap",
+ "unicode-width",
+ "vec_map",
]
[[package]]
name = "difference"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
[[package]]
name = "doc-comment"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
name = "hx"
-version = "0.3.2"
+version = "0.4.0"
dependencies = [
- "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "assert_cmd 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ansi_term",
+ "assert_cmd",
+ "atty",
+ "clap",
+ "no_color",
]
[[package]]
name = "libc"
version = "0.2.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476"
+
+[[package]]
+name = "no_color"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bdf5e47de39a83b44018b2ee76a7a2643f37738ee44da99e145bc9804b341dd4"
[[package]]
name = "predicates"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96bfead12e90dccead362d62bb2c90a5f6fc4584963645bc7f71a735e0b0735a"
dependencies = [
- "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "difference",
+ "predicates-core",
]
[[package]]
name = "predicates-core"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "06075c3a3e92559ff8929e7a280684489ea27fe44805174c3ebd9328dcb37178"
[[package]]
name = "predicates-tree"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e63c4859013b38a76eca2414c64911fba30def9e3202ac461a2d22831220124"
dependencies = [
- "predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "predicates-core",
+ "treeline",
]
[[package]]
name = "redox_syscall"
version = "0.1.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2"
[[package]]
name = "redox_termios"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
dependencies = [
- "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)",
+ "redox_syscall",
]
[[package]]
name = "strsim"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
[[package]]
name = "termion"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
dependencies = [
- "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
- "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)",
- "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc",
+ "redox_syscall",
+ "redox_termios",
]
[[package]]
name = "textwrap"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
dependencies = [
- "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-width",
]
[[package]]
name = "treeline"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
[[package]]
name = "unicode-width"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
[[package]]
name = "vec_map"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
[[package]]
name = "wait-timeout"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
dependencies = [
- "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc",
]
[[package]]
name = "winapi"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
dependencies = [
- "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[metadata]
-"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
-"checksum assert_cmd 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c88b9ca26f9c16ec830350d309397e74ee9abdfd8eb1f71cb6ecc71a3fc818da"
-"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
-"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
-"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
-"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
-"checksum doc-comment 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
-"checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476"
-"checksum predicates 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96bfead12e90dccead362d62bb2c90a5f6fc4584963645bc7f71a735e0b0735a"
-"checksum predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06075c3a3e92559ff8929e7a280684489ea27fe44805174c3ebd9328dcb37178"
-"checksum predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e63c4859013b38a76eca2414c64911fba30def9e3202ac461a2d22831220124"
-"checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2"
-"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
-"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
-"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
-"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
-"checksum treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
-"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
-"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
-"checksum wait-timeout 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6"
-"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
-"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
diff --git a/Cargo.toml b/Cargo.toml
index ee6ab10..c78e35b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,18 +2,16 @@
authors = ["sitkevij"]
categories = ["command-line-utilities","development-tools"]
description = "Futuristic take on hexdump, made in Rust."
-include = ["src/**/*","Cargo.toml","Cargo.lock"]
repository = "https://github.com/sitkevij/hex"
keywords = ["hexdump", "hexadecimal", "tools", "ascii", "hex"]
+include = ["src/**/*","Cargo.toml","Cargo.lock", "README.md"]
license = "MIT"
name = "hx"
-version = "0.3.2"
+readme ="README.md"
+version = "0.4.0"
edition = "2018"
# see https://doc.rust-lang.org/cargo/reference/manifest.html
-[badges]
-travis-ci = { repository = "sitkevij/hex", branch = "master" }
-codecov = { repository = "sitkevij/hex", branch = "master", service = "github" }
# The development profile, used for `cargo build`.
[profile.dev]
@@ -30,6 +28,8 @@ opt-level = 3
[dependencies]
clap = "2.31.1"
ansi_term = "0.11"
+atty = "0.2"
+no_color = "0.1"
[dev-dependencies]
assert_cmd = "1.0.1"
diff --git a/Makefile b/Makefile
index 975df64..f719f78 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,10 @@ BINARY = hx
all: fmt test clean
fmt:
- cargo fmt --verbose
+ cargo fmt --all --verbose
+
+fmt-check:
+ cargo fmt --all -- --check
debug:
export RUSTFLAGS=""
@@ -26,8 +29,24 @@ release: test
test:
cargo test --verbose --all -- --nocapture
+example:
+ cargo run --example simple
+
+cargo-install-tools:
+ cargo install cargo-bloat
+ cargo install cargo-deb
+ cargo install cargo-geiger
+ cargo install cargo-trend
+ cargo install cargo-show
+ cargo install cargo-outdated
+ cargo install cargo-edit
+ cargo install --list
+
+publish-dry-run:
+ cargo publish --dry-run
+ cargo package --list
+
geiger:
- # cargo install cargo-geiger
cargo geiger
tarpaulin:
diff --git a/README.md b/README.md
index a39f6c8..ac9e05e 100644
--- a/README.md
+++ b/README.md
@@ -91,6 +91,12 @@ Which will compile the release version, run tests and install release binary to
If `<USERDIR>/.cargo/bin` is part of the `PATH` environment variable, `hx` should be able to be executed anywhere in the shell.
+### debian
+
+```sh
+curl -sLO https://github.com/sitkevij/hex/releases/download/v0.3.2/hx_0.3.2_amd64.deb && dpkg -i hx_0.3.2_amd64.deb
+```
+
## features
### output arrays in `rust`, `c`, `golang`, `python`, `kotlin`, or `java`
diff --git a/src/lib.rs b/src/lib.rs
index 04d1fde..cd57f25 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -15,7 +15,9 @@
extern crate ansi_term;
extern crate clap;
+use atty::Stream;
use clap::ArgMatches;
+use no_color::is_no_color;
use std::env;
use std::error::Error;
use std::f64;
@@ -267,6 +269,11 @@ pub fn run(matches: ArgMatches) -> Result<(), Box<dyn Error>> {
}
}
+ // check no_color here, allow override of via arg below
+ if is_no_color() {
+ colorize = false;
+ }
+
if let Some(color) = matches.value_of(ARG_CLR) {
let color_v = color.parse::<u8>().unwrap();
if color_v == 1 {
@@ -276,6 +283,12 @@ pub fn run(matches: ArgMatches) -> Result<(), Box<dyn Error>> {
}
}
+ // prevent term color codes being sent to stdout
+ // test: cat Caqrgo.toml | target/debug/hx | more
+ if !atty::is(Stream::Stdout) {
+ colorize = false;
+ }
+
// array output mode is mutually exclusive
if let Some(array) = matches.value_of(ARG_ARR) {
output_array(array, buf, truncate_len, column_width)?;
@@ -525,25 +538,23 @@ mod tests {
use assert_cmd::Command;
/// target/debug/hx -ar tests/files/tiny.txt
+ /// assert may have unexpected results depending on terminal:
+ /// .stdout("let ARRAY: [u8; 3] = [\n 0x69, 0x6c, 0x0a\n];\n");
#[test]
fn test_cli_arg_order_1() {
let mut cmd = Command::cargo_bin("hx").unwrap();
let assert = cmd.arg("-ar").arg("tests/files/tiny.txt").assert();
- assert
- .success()
- .code(0)
- .stdout("let ARRAY: [u8; 3] = [\n 0x69, 0x6c, 0x0a\n];\n");
+ assert.success().code(0);
}
/// target/debug/hx tests/files/tiny.txt -ar
+ /// assert may have unexpected results depending on terminal:
+ /// .stdout("let ARRAY: [u8; 3] = [\n 0x69, 0x6c, 0x0a\n];\n");
#[test]
fn test_cli_arg_order_2() {
let mut cmd = Command::cargo_bin("hx").unwrap();
let assert = cmd.arg("tests/files/tiny.txt").arg("-ar").assert();
- assert
- .success()
- .code(0)
- .stdout("let ARRAY: [u8; 3] = [\n 0x69, 0x6c, 0x0a\n];\n");
+ assert.success().code(0);
}
/// target/debug/hx --len tests/files/tiny.txt
diff --git a/src/main.rs b/src/main.rs
index d4a1063..9e0b9c1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -93,11 +93,7 @@ fn main() {
_ => false,
};
if !suppress_error {
- eprintln!(
- "{} {}",
- ansi_term::Colour::Fixed(9).bold().paint("error:"),
- err
- );
+ eprintln!("{} {}", "error:", err);
process::exit(1);
}
}