summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2020-07-06 14:32:07 +0800
committerSebastian Thiel <sebastian.thiel@icloud.com>2020-07-06 14:32:07 +0800
commit464829e11f5d6d63019ec167e2e1b1b7c0061f0a (patch)
tree32a40d4297093f964747387e5e0c9229e9544ab9 /src
parentd0c362ae0f0f7ff4d49d899591c6cbb205e6b191 (diff)
Make interactive mode optional, allow selection of backend for windows, unix
Diffstat (limited to 'src')
-rw-r--r--src/main.rs10
-rw-r--r--src/options.rs1
2 files changed, 8 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 91d0fce..a47fc22 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,12 +1,11 @@
#![forbid(unsafe_code)]
#![allow(clippy::match_bool)]
-use crate::interactive::{Interaction, TerminalApp};
-use anyhow::{Context, Result};
-use crosstermion::terminal::{tui::new_terminal, AlternateRawScreen};
+use anyhow::Result;
use dua::{ByteFormat, Color, TraversalSorting};
use std::{fs, io, io::Write, path::PathBuf, process};
use structopt::StructOpt;
+#[cfg(any(feature = "tui-unix", feature = "tui-crossplatform"))]
mod interactive;
mod options;
@@ -28,7 +27,12 @@ fn main() -> Result<()> {
cross_filesystems: !opt.stay_on_filesystem,
};
let res = match opt.command {
+ #[cfg(any(feature = "tui-unix", feature = "tui-crossplatform"))]
Some(Interactive { input }) => {
+ use crate::interactive::{Interaction, TerminalApp};
+ use anyhow::Context;
+ use crosstermion::terminal::{tui::new_terminal, AlternateRawScreen};
+
let mut terminal = new_terminal(
AlternateRawScreen::try_from(io::stdout())
.with_context(|| "Interactive mode requires a connected terminal")?,
diff --git a/src/options.rs b/src/options.rs
index 992f823..a7d7618 100644
--- a/src/options.rs
+++ b/src/options.rs
@@ -72,6 +72,7 @@ pub struct Args {
#[derive(Debug, StructOpt)]
pub enum Command {
/// Launch the terminal user interface
+ #[cfg(any(feature = "tui-unix", feature = "tui-crossplatform"))]
#[structopt(name = "interactive", visible_alias = "i")]
Interactive {
/// One or more input files or directories. If unset, we will use all entries in the current working directory.