NO_COLOR support

master
chris west 3 years ago
parent 0db0c7e149
commit 2e78294135

@ -1,10 +1,15 @@
## v0.1.13-dev
## v0.1.14-dev
- If the `NO_COLOR` env variable is set, colors won't be printed to
the log. Same as starting with `--no-color`.
See https://no-color.org/.
## v0.1.13
- Added `--no-color` command line option to not display color when
logging.
- Slight change to binding behavior: if `-p` is passed without `-b`,
we'll try to bind to that port. To this easier: `phd -p 7777`
we'll try to bind to that port. To this easier: `phd -p 7777`
- Accept `?` as query string indicator, not just `TAB`. See #3.
## v0.1.12
@ -29,7 +34,6 @@ For now you can view it by cloning the repository and running:
Enjoy!
## v0.1.10
`phd` can now render a single page to stdout, instead of starting

@ -13,6 +13,7 @@ fn main() {
let mut host = DEFAULT_HOST;
let mut port = DEFAULT_PORT;
let mut render = "";
while let Some(arg) = args.next() {
match arg.as_ref() {
"--version" | "-v" | "-version" => return print_version(),
@ -64,6 +65,11 @@ fn main() {
}
}
// https://no-color.org/
if std::env::var("NO_COLOR").is_ok() {
phd::color::hide_colors()
}
// If port was given and socket wasn't, bind to that port.
let bind = if port != DEFAULT_PORT && addr == DEFAULT_BIND {
format!("[::]:{}", port).parse().unwrap()

Loading…
Cancel
Save