1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:07:35 +00:00

fortune: Use simple formatting when stdout isn't connected to a terminal

This changes the default behavior, so that, by default, color codes,
hyperlinks and additional spacing are only emitted when standard
output is connected to a terminal.

The default coloring behavior can be overridden with the `--color`
option. Valid arguments for this option are: 'always', 'never' and
'auto' (default).
This commit is contained in:
Tim Ledbetter 2023-08-05 18:38:55 +01:00 committed by Andreas Kling
parent db5ad0c2b0
commit 7f99f3bf29
2 changed files with 47 additions and 9 deletions

View file

@ -5,13 +5,17 @@ fortune
## Synopsis
```sh
$ fortune [path]
$ fortune [--color when] [path]
```
## Description
Open a fortune cookie, receive a free quote for the day!
## Options
* `--color when`: Chose when to color the output. Valid options are always, never and auto (default). When color is set to auto, color codes will be emitted when stdout is a terminal
## Arguments
* `path`: Path to JSON file with quotes (/res/fortunes.json by default)