Skip to content

Commit

Permalink
Cargo npk improvements (#1137)
Browse files Browse the repository at this point in the history
* Fix comments from apk to npk

Signed-off-by: Jean-Christophe Dubois <[email protected]>

* Move from atty to is-terminal package

atty is Unmaintained and has an RUSTSEC Advisory

Signed-off-by: Jean-Christophe Dubois <[email protected]>

* Bump cargo_metadata from "0.15.3" to "0.18.1"

cargo_metadata v0.15.3 is outdated

Signed-off-by: Jean-Christophe Dubois <[email protected]>

* User std:io:IsTerminal instead of is_terminal

Signed-off-by: Jean-Christophe Dubois <[email protected]>

* Increase the minimal rust version to be compatible with is_terminal

Signed-off-by: Jean-Christophe Dubois <[email protected]>

---------

Signed-off-by: Jean-Christophe Dubois <[email protected]>
  • Loading branch information
jcdubois authored Jun 25, 2024
1 parent 7d9e342 commit 03b4b5b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/esrlabs/northstar"
rust-version = "1.65.0"
rust-version = "1.70.0"

[workspace]
members = [
Expand Down
3 changes: 1 addition & 2 deletions cargo-npk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ rust-version.workspace = true

[dependencies]
anyhow = "1.0.80"
atty = "0.2.14"
cargo-subcommand = { version = "0.12.0", features = ["clap"] }
cargo_metadata = "0.15.3"
cargo_metadata = "0.18.1"
clap = { version = "4.4.18", features = ["derive"] }
human_bytes = "0.4.3"
humantime = "2.1.0"
Expand Down
4 changes: 2 additions & 2 deletions cargo-npk/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl Display for Compression {
#[group(skip)]
#[allow(clippy::large_enum_variant)]
pub enum NpkSubCommand {
/// Compile the current package and create an apk
/// Compile the current package and create a npk
Pack {
#[clap(flatten)]
args: Args,
Expand All @@ -91,6 +91,6 @@ pub enum NpkSubCommand {
#[clap(long("out"))]
out: Option<PathBuf>,
},
/// Print the version of cargo-apk
/// Print the version of cargo-npk
Version,
}
4 changes: 3 additions & 1 deletion cargo-npk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use northstar_runtime::npk::npk::{NpkBuilder, SquashfsOptions};

use crate::metadata::Metadata;

use std::io::IsTerminal;

mod cli;
mod metadata;

Expand Down Expand Up @@ -307,7 +309,7 @@ fn stdout(choice: ColorChoice) -> StandardStream {
ColorChoice::Always => termcolor::ColorChoice::Always,
ColorChoice::Never => termcolor::ColorChoice::AlwaysAnsi,
ColorChoice::Auto => {
if atty::is(atty::Stream::Stdout) {
if std::io::stdout().is_terminal() {
termcolor::ColorChoice::Auto
} else {
termcolor::ColorChoice::Never
Expand Down

0 comments on commit 03b4b5b

Please sign in to comment.