summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-04-17 17:39:54 +0200
committerGitHub <noreply@github.com>2018-04-17 17:39:54 +0200
commit88b57910dfa63c935f67ee3c0c94106f0f525749 (patch)
treec590c5b66276e1c511b93bd944a7657834e53eb7
parent877f0dfb6b71d2b816b1d21d17e1c71497fcf32e (diff)
parentd7cfab797ff204f32324a868651d22079bf43946 (diff)
downloadimag-88b57910dfa63c935f67ee3c0c94106f0f525749.zip
imag-88b57910dfa63c935f67ee3c0c94106f0f525749.tar.gz
Merge pull request #1403 from matthiasbeyer/remove-pipe-magic
Revert "Implement pipe magic in libimagrt"
-rw-r--r--lib/core/libimagrt/src/runtime.rs28
1 files changed, 6 insertions, 22 deletions
diff --git a/lib/core/libimagrt/src/runtime.rs b/lib/core/libimagrt/src/runtime.rs
index 2aa091e..40ffac2 100644
--- a/lib/core/libimagrt/src/runtime.rs
+++ b/lib/core/libimagrt/src/runtime.rs
@@ -52,7 +52,6 @@ pub struct Runtime<'a> {
configuration: Option<Value>,
cli_matches: ArgMatches<'a>,
store: Store,
- use_pipe_magic: bool,
stdin_is_tty: bool,
stdout_is_tty: bool,
}
@@ -139,15 +138,12 @@ impl<'a> Runtime<'a> {
Store::new(storepath, &config)
};
- let pipe_magic = matches.is_present(Runtime::pipe_magic_name());
-
store_result.map(|store| {
Runtime {
cli_matches: matches,
configuration: config,
rtp: rtp,
store: store,
- use_pipe_magic: pipe_magic,
stdout_is_tty: ::atty::is(::atty::Stream::Stdout),
stdin_is_tty: ::atty::is(::atty::Stream::Stdin),
}
@@ -237,13 +233,6 @@ impl<'a> Runtime<'a> {
.takes_value(true)
.value_name("LOGDESTS"))
- .arg(Arg::with_name(Runtime::pipe_magic_name())
- .long(Runtime::pipe_magic_name())
- .short("P")
- .help("Use pipe-detection. With this flag, imag expects a JSON store on STDIN if stdin is not a TTY and prints the store to STDOUT if it is not a TTY.")
- .required(false)
- .takes_value(false))
-
}
/// Get the argument names of the Runtime which are available
@@ -328,11 +317,6 @@ impl<'a> Runtime<'a> {
"logging-destinations"
}
- /// Get the argument name for pipe magic
- pub fn pipe_magic_name() -> &'static str {
- "pipe-magic"
- }
-
/// Initialize the internal logger
fn init_logger(matches: &ArgMatches, config: Option<&Value>) {
use log::set_max_level;
@@ -461,10 +445,10 @@ impl<'a> Runtime<'a> {
}
pub fn stdout(&self) -> OutputProxy {
- if self.use_pipe_magic && !self.stdout_is_tty {
- OutputProxy::Err(::std::io::stderr())
- } else {
+ if self.stdout_is_tty {
OutputProxy::Out(::std::io::stdout())
+ } else {
+ OutputProxy::Err(::std::io::stderr())
}
}
@@ -473,10 +457,10 @@ impl<'a> Runtime<'a> {
}
pub fn stdin(&self) -> Option<Stdin> {
- if self.use_pipe_magic && !self.stdin_is_tty {
- None
- } else {
+ if self.stdin_is_tty {
Some(::std::io::stdin())
+ } else {
+ None
}
}