Skip to content

Commit

Permalink
Remove atty
Browse files Browse the repository at this point in the history
  • Loading branch information
DrSensor committed Sep 17, 2019
1 parent 2885f7a commit 8c2c03b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ name = "mask"
path = "src/lib.rs"

[dependencies]
# see https://rust-lang-nursery.github.io/cli-wg/in-depth/machine-communication.html?highlight=atty#whos-reading-this
atty = "0.2" # https://github.com/softprops/atty
colored = "1.8.0" # https://github.com/mackwic/colored
pulldown-cmark = { version = "0.5", default-features = false } # https://github.com/raphlinus/pulldown-cmark

Expand Down
13 changes: 2 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::env;
use std::path::Path;

use atty::{self, Stream};
use clap::{
crate_authors, crate_description, crate_name, crate_version, App, AppSettings, Arg, ArgMatches,
SubCommand,
Expand All @@ -15,11 +14,7 @@ fn main() {
let cli_app = App::new(crate_name!())
.setting(AppSettings::VersionlessSubcommands)
.setting(AppSettings::SubcommandRequired)
.setting(if atty::is(Stream::Stdout) {
AppSettings::ColoredHelp
} else {
AppSettings::ColorNever // in case it run on terminal without color support
})
.setting(AppSettings::ColoredHelp)
.version(crate_version!())
.author(crate_authors!())
.about(crate_description!())
Expand Down Expand Up @@ -97,11 +92,7 @@ fn build_subcommands<'a, 'b>(
for c in subcommands {
let mut subcmd = SubCommand::with_name(&c.name)
.about(c.desc.as_ref())
.setting(if atty::is(Stream::Stdout) {
AppSettings::ColoredHelp
} else {
AppSettings::ColorNever // in case it run on terminal without color support
});
.setting(AppSettings::ColoredHelp);
if !c.subcommands.is_empty() {
subcmd = build_subcommands(subcmd, &c.subcommands);
// If this parent command has no script source, require a subcommand.
Expand Down

0 comments on commit 8c2c03b

Please sign in to comment.