Skip to content

Commit

Permalink
Move colors to fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Aug 22, 2019
1 parent d7a837d commit dfa7ee4
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .ci/check_source_file_changes.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
31 changes: 0 additions & 31 deletions colors/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion examples/catj.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion examples/colors.ts
Original file line number Diff line number Diff line change
@@ -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!")))));
12 changes: 12 additions & 0 deletions colors/mod.ts → fmt/colors.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion colors/test.ts → fmt/colors_test.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion log/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion testing/asserts.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion testing/asserts_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
2 changes: 1 addition & 1 deletion testing/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion ws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
2 changes: 1 addition & 1 deletion ws/example_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit dfa7ee4

Please sign in to comment.