diff options
author | Sebastian Wiesner <sebastian@swsnr.de> | 2018-09-24 22:49:21 +0200 |
---|---|---|
committer | Sebastian Wiesner <sebastian@swsnr.de> | 2018-09-24 22:53:07 +0200 |
commit | 521bf23957c3ff7e37869792246db39c138d3bfa (patch) | |
tree | c81499f7f7e4eea982494aac1066dc2f69d255af /src | |
parent | de83424077abcec98204f11642741628ebf1ceb3 (diff) |
Add hidden flag to ignore special tty formatting
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index dc01937..03cd055 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,7 +34,7 @@ use std::io::{stdin, stdout, Stdout}; use std::path::PathBuf; use syntect::parsing::SyntaxSet; -use mdcat::{detect_terminal, DumbTerminal, ResourceAccess, Terminal, TerminalSize}; +use mdcat::{detect_terminal, AnsiTerminal, DumbTerminal, ResourceAccess, Terminal, TerminalSize}; /// Read input for `filename`. /// @@ -104,6 +104,8 @@ impl Arguments { let terminal = if matches.is_present("no_colour") { // If the user disabled colours assume a dumb terminal Box::new(DumbTerminal::new(stdout())) + } else if matches.is_present("ansi_only") { + Box::new(AnsiTerminal::new(stdout())) } else { detect_terminal() }; @@ -195,6 +197,13 @@ Report issues to <https://github.com/lunaryorn/mdcat>.", .long("detect-only") .help("Only detect the terminal type and exit") .hidden(true) + ) + .arg( + Arg::with_name("ansi_only") + .long("ansi-only") + .help("Limit to standard ANSI formatting") + .conflicts_with("no_colour") + .hidden(true) ); let matches = app.get_matches(); |