Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
Add --detect-terminal option
Browse files Browse the repository at this point in the history
  • Loading branch information
swsnr committed Jan 7, 2023
1 parent c3d5631 commit 1760707
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ To publish a new release run `scripts/release` from the project directory.

## [Unreleased]

### Added
- Add `--detect-terminal` to print the name of the detected terminal program (see [GH-232]).

### Changed

- Replace `ureq` with `reqwest` (see [GH-229]).
Expand Down
5 changes: 4 additions & 1 deletion mdcat.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ This is the default when run as `mdcat`.

--fail::
Fail immediately at the first FILE which fails to read.
By default mdcat continues with the next file.
By default, mdcat continues with the next file.

--detect-terminal::
Detect the terminal program, print its name, and exit.

-h::
--help::
Expand Down
6 changes: 3 additions & 3 deletions src/bin/mdcat/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ pub struct CommonArgs {
/// Exit immediately if any error occurs processing an input file.
#[arg(long = "fail")]
pub fail_fast: bool,
/// Only detect the terminal type and exit.
#[arg(long, hide = true)]
pub detect_only: bool,
/// Print detected terminal name and exit.
#[arg(long = "detect-terminal")]
pub detect_and_exit: bool,
/// Limit to standard ANSI formatting.
#[arg(long, conflicts_with = "no_colour", hide = true)]
pub ansi_only: bool,
Expand Down
2 changes: 1 addition & 1 deletion src/bin/mdcat/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ fn main() {
TerminalProgram::detect()
};

if args.detect_only {
if args.detect_and_exit {
println!("Terminal: {}", terminal_app);
} else {
// On Windows 10 we need to enable ANSI term explicitly.
Expand Down

0 comments on commit 1760707

Please sign in to comment.