summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsitkevij <1553398+sitkevij@users.noreply.github.com>2023-12-28 10:21:50 -0800
committersitkevij <1553398+sitkevij@users.noreply.github.com>2023-12-28 10:21:50 -0800
commit2a2dbdafaa352f545456f66973a5a277dd4d2657 (patch)
tree60d296915d5940e677571f681edbde71e3486ab0
parent084e3d16e9f34b352c12b8fdb4a611240d6794e7 (diff)
chore: use IsTerminal
-rw-r--r--.github/workflows/ci.yml55
-rw-r--r--.github/workflows/stale.yml33
-rw-r--r--Cargo.lock40
-rw-r--r--Cargo.toml9
-rw-r--r--src/lib.rs4
5 files changed, 80 insertions, 61 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d4a25aa..9dbec6f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -19,25 +19,50 @@ env:
jobs:
test:
- name: Test Rust ${{ matrix.rust }} on ${{ matrix.os }}
- runs-on: ${{ matrix.os }}
+ name: Test Rust ${{ matrix.name }} on ${{ matrix.target }}
+ runs-on: ${{ matrix.runner }}
continue-on-error: ${{ matrix.experimental }}
strategy:
- fail-fast: false
matrix:
include:
- - { rust: stable, os: ubuntu-latest, experimental: false }
- - { rust: stable, os: macos-latest, experimental: false }
- - { rust: stable, os: windows-latest, experimental: true }
- - { rust: stable-i686-msvc, os: windows-latest, experimental: true }
- - { rust: beta, os: ubuntu-latest, experimental: true }
- - { rust: nightly, os: ubuntu-latest, experimental: true }
+ - name: linux-amd64
+ runner: ubuntu-latest
+ target: x86_64-unknown-linux-gnu
+ experimental: false
+ toolchain: stable
+ - name: win-amd64
+ runner: windows-latest
+ target: x86_64-pc-windows-msvc
+ experimental: false
+ toolchain: stable
+ - name: macos-amd64
+ runner: macos-latest
+ target: x86_64-apple-darwin
+ experimental: false
+ toolchain: stable
+ - name: macos-arm64
+ runner: macos-latest
+ target: aarch64-apple-darwin
+ experimental: false
+ toolchain: stable
+ - name: linux-amd64
+ runner: ubuntu-latest
+ target: x86_64-unknown-linux-gnu
+ experimental: true
+ toolchain: beta
+ - name: linux-amd64
+ runner: ubuntu-latest
+ target: x86_64-unknown-linux-gnu
+ experimental: true
+ toolchain: nightly
steps:
- - uses: actions/checkout@v4
- - uses: hecrj/setup-rust-action@v2
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Rust toolchain
+ uses: dtolnay/rust-toolchain@master
with:
- rust-version: ${{ matrix.rust }}
-
+ toolchain: "${{ matrix.toolchain }}"
+ targets: "${{ matrix.target }}"
- run: cargo build --verbose --all
- run: cargo build --release
- run: cargo test --verbose --all -- --nocapture
@@ -55,7 +80,7 @@ jobs:
RUSTFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v4
- - uses: hecrj/setup-rust-action@v2
+ - uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy --workspace --all-targets --verbose
@@ -67,7 +92,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- - uses: hecrj/setup-rust-action@v2
+ - uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
new file mode 100644
index 0000000..13fea97
--- /dev/null
+++ b/.github/workflows/stale.yml
@@ -0,0 +1,33 @@
+name: stale
+on:
+ schedule:
+ - cron: "30 1 * * *"
+ workflow_dispatch:
+
+permissions:
+ issues: write
+ pull-requests: write
+ discussions: write
+
+jobs:
+ stale:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/stale@v8
+ with:
+ stale-issue-message: "Issue marked stale due to no recent activity."
+ stale-issue-label: "stale"
+ exempt-issue-labels: "enhancement, help wanted, in progress, upstream"
+ stale-pr-message: "PR marked stale due to no recent activity."
+ stale-pr-label: "stale"
+ exempt-pr-labels: "enhancement, help wanted, in progress, upstream"
+ close-issue-message: "Issue closed due to no recent activity for an extended period."
+ close-pr-message: "PR closed due to no recent activity for an extended period."
+ days-before-issue-stale: 30
+ days-before-pr-stale: 45
+ days-before-issue-close: 5
+ days-before-pr-close: 10
+ - uses: dessant/lock-threads@v5
+ with:
+ exclude-any-issue-labels: "enhancement, help wanted, in progress, upstream"
+ process-only: "issues"
diff --git a/Cargo.lock b/Cargo.lock
index db159e8..bcf03f9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -75,17 +75,6 @@ dependencies = [
]
[[package]]
-name = "atty"
-version = "0.2.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
-dependencies = [
- "libc",
- "termion",
- "winapi",
-]
-
-[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -195,11 +184,10 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hx"
-version = "0.5.0"
+version = "0.6.0"
dependencies = [
"ansi_term",
"assert_cmd",
- "atty",
"clap",
"no_color",
"rusty-hook",
@@ -295,21 +283,6 @@ dependencies = [
]
[[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",
-]
-
-[[package]]
name = "regex-automata"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -365,17 +338,6 @@ dependencies = [
]
[[package]]
-name = "termion"
-version = "1.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
-dependencies = [
- "libc",
- "redox_syscall",
- "redox_termios",
-]
-
-[[package]]
name = "termtree"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index d276b3f..cc7aa4b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,7 +8,7 @@ include = ["src/**/*", "Cargo.toml", "Cargo.lock", "README.md", "hx.1"]
license = "MIT"
name = "hx"
readme = "README.md"
-version = "0.5.0"
+version = "0.6.0"
edition = "2021"
# see https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -26,11 +26,10 @@ panic = 'unwind' # panic strategy (`-C panic=...`), can also be 'abort'
opt-level = 3
[dependencies]
-clap = "4.4.8"
+clap = "4.4"
ansi_term = "0.12"
-atty = "0.2"
no_color = "0.1"
[dev-dependencies]
-assert_cmd = "2.0.12"
-rusty-hook = "^0.11.2"
+assert_cmd = "2.0"
+rusty-hook = "^0.11"
diff --git a/src/lib.rs b/src/lib.rs
index 7f3c141..b50ace3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -15,7 +15,6 @@
extern crate ansi_term;
extern crate clap;
-use atty::Stream;
use clap::ArgMatches;
use no_color::is_no_color;
use std::env;
@@ -23,6 +22,7 @@ use std::error::Error;
use std::f64;
use std::fs;
use std::io::BufReader;
+use std::io::IsTerminal;
use std::io::{self, BufRead, Read, Write};
/// arg cols
@@ -309,7 +309,7 @@ pub fn run(matches: ArgMatches) -> Result<(), Box<dyn Error>> {
// prevent term color codes being sent to stdout
// test: cat Cargo.toml | target/debug/hx | more
// override via ARG_CLR below
- if !atty::is(Stream::Stdout) {
+ if !io::stdout().is_terminal() {
colorize = false;
}