mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 07:44:48 -05:00
parent
e933a8a0e1
commit
4d997d4e22
12 changed files with 22 additions and 41 deletions
|
@ -1,6 +1,6 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import { xrun } from "../prettier/util.ts";
|
||||
import { red, green } from "../colors/mod.ts";
|
||||
import { red, green } from "../fmt/colors.ts";
|
||||
|
||||
/**
|
||||
* Checks whether any source file is changed since the given start time.
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
# colors
|
||||
|
||||
Is a basic console color module intended for [Deno](https://deno.land/). It is
|
||||
inspired by [chalk](https://www.npmjs.com/package/chalk),
|
||||
[kleur](https://www.npmjs.com/package/kleur), and
|
||||
[colors](https://www.npmjs.com/package/colors) on npm.
|
||||
|
||||
## Usage
|
||||
|
||||
The main modules exports several functions which can color the output to the
|
||||
console:
|
||||
|
||||
```ts
|
||||
import { bgBlue, red, bold } from "https://deno.land/std/colors/mod.ts";
|
||||
|
||||
console.log(bgBlue(red(bold("Hello world!"))));
|
||||
```
|
||||
|
||||
This module supports `NO_COLOR` environmental variable disabling any coloring if `NO_COLOR` is set.
|
||||
|
||||
## TODO
|
||||
|
||||
- Currently, it just assumes it is running in an environment that supports ANSI
|
||||
escape code terminal coloring. It should actually detect, specifically windows
|
||||
and adjust properly.
|
||||
|
||||
- Test coverage is very basic at the moment.
|
||||
|
||||
---
|
||||
|
||||
Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
import { parse } from "../flags/mod.ts";
|
||||
import * as colors from "../colors/mod.ts";
|
||||
import * as colors from "../fmt/colors.ts";
|
||||
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import { bgBlue, red, bold, italic } from "../colors/mod.ts";
|
||||
import { bgBlue, red, bold, italic } from "../fmt/colors.ts";
|
||||
|
||||
console.log(bgBlue(italic(red(bold("Hello world!")))));
|
||||
|
|
|
@ -1,4 +1,16 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
/**
|
||||
* A module to print ANSI terminal colors. Inspired by chalk, kleur, and colors
|
||||
* on npm.
|
||||
*
|
||||
* ```
|
||||
* import { bgBlue, red, bold } from "https://deno.land/std/fmt/colors.ts";
|
||||
* console.log(bgBlue(red(bold("Hello world!"))));
|
||||
* ```
|
||||
*
|
||||
* This module supports `NO_COLOR` environmental variable disabling any coloring
|
||||
* if `NO_COLOR` is set.
|
||||
*/
|
||||
const { noColor } = Deno;
|
||||
|
||||
interface Code {
|
|
@ -1,7 +1,7 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import { test } from "../testing/mod.ts";
|
||||
import { assertEquals } from "../testing/asserts.ts";
|
||||
import * as c from "./mod.ts";
|
||||
import * as c from "./colors.ts";
|
||||
import "../examples/colors.ts";
|
||||
|
||||
test(function singleColor(): void {
|
|
@ -4,7 +4,7 @@ type File = Deno.File;
|
|||
type Writer = Deno.Writer;
|
||||
import { getLevelByName, LogLevel } from "./levels.ts";
|
||||
import { LogRecord } from "./logger.ts";
|
||||
import { red, yellow, blue, bold } from "../colors/mod.ts";
|
||||
import { red, yellow, blue, bold } from "../fmt/colors.ts";
|
||||
|
||||
const DEFAULT_FORMATTER = "{levelName} {msg}";
|
||||
type FormatterFunction = (logRecord: LogRecord) => string;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||
import { red, green, white, gray, bold } from "../colors/mod.ts";
|
||||
import { red, green, white, gray, bold } from "../fmt/colors.ts";
|
||||
import diff, { DiffType, DiffResult } from "./diff.ts";
|
||||
import { format } from "./format.ts";
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
unreachable
|
||||
} from "./asserts.ts";
|
||||
import { test } from "./mod.ts";
|
||||
import { red, green, white, gray, bold } from "../colors/mod.ts";
|
||||
import { red, green, white, gray, bold } from "../fmt/colors.ts";
|
||||
|
||||
test(function testingEqual(): void {
|
||||
assert(equal("world", "world"));
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
gray,
|
||||
yellow,
|
||||
italic
|
||||
} from "../colors/mod.ts";
|
||||
} from "../fmt/colors.ts";
|
||||
export type TestFunction = () => void | Promise<void>;
|
||||
|
||||
export interface TestDefinition {
|
||||
|
|
|
@ -85,7 +85,7 @@ import {
|
|||
import { encode } from "https://deno.land/std/strings/mod.ts";
|
||||
import { BufReader } from "https://deno.land/std/io/bufio.ts";
|
||||
import { TextProtoReader } from "https://deno.land/std/textproto/mod.ts";
|
||||
import { blue, green, red, yellow } from "https://deno.land/std/colors/mod.ts";
|
||||
import { blue, green, red, yellow } from "https://deno.land/std/fmt/colors.ts";
|
||||
|
||||
const endpoint = Deno.args[1] || "ws://127.0.0.1:8080";
|
||||
async function main(): Promise<void> {
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
import { encode } from "../strings/mod.ts";
|
||||
import { BufReader } from "../io/bufio.ts";
|
||||
import { TextProtoReader } from "../textproto/mod.ts";
|
||||
import { blue, green, red, yellow } from "../colors/mod.ts";
|
||||
import { blue, green, red, yellow } from "../fmt/colors.ts";
|
||||
|
||||
const endpoint = Deno.args[1] || "ws://127.0.0.1:8080";
|
||||
/** simple websocket cli */
|
||||
|
|
Loading…
Reference in a new issue