Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(examples): use workspace specifier for imports #728

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/ansi.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env -S deno run

import { colors } from "@cliffy/ansi/colors";
import { tty } from "@cliffy/ansi/tty";
import { delay } from "@std/async/delay";
import { colors } from "../ansi/colors.ts";
import { tty } from "../ansi/tty.ts";

const error = colors.bold.red;
const warn = colors.bold.yellow;
Expand Down
2 changes: 1 addition & 1 deletion examples/ansi/color_themes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { colors } from "../../ansi/colors.ts";
import { colors } from "@cliffy/ansi/colors";

// Define theme colors.
const error = colors.bold.red;
Expand Down
2 changes: 1 addition & 1 deletion examples/ansi/colors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { colors } from "../../ansi/colors.ts";
import { colors } from "@cliffy/ansi/colors";

console.log(
colors.bold.underline.rgb24("Welcome to Deno.Land!", 0xff3333),
Expand Down
4 changes: 2 additions & 2 deletions examples/ansi/countdown.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env -S deno run --allow-net=deno.land

import { colors } from "../../ansi/colors.ts";
import { tty } from "../../ansi/tty.ts";
import { colors } from "@cliffy/ansi/colors";
import { tty } from "@cliffy/ansi/tty";

for await (const i of [3, 2, 1]) {
console.log(i);
Expand Down
2 changes: 1 addition & 1 deletion examples/ansi/cursor_position.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { getCursorPosition } from "../../ansi/cursor_position.ts";
import { getCursorPosition } from "@cliffy/ansi/cursor-position";

Deno.stdout.writeSync(new TextEncoder().encode("Hallo world!"));
console.log("\ngetCursorPosition:", getCursorPosition());
2 changes: 1 addition & 1 deletion examples/ansi/custom.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env -S deno run --allow-net=deno.land

import { rgb24 } from "@std/fmt/colors";
import { tty } from "../../ansi/tty.ts";
import { tty } from "@cliffy/ansi/tty";

const response = await fetch("https://deno.land/images/hashrock_simple.png");
const imageBuffer: ArrayBuffer = await response.arrayBuffer();
Expand Down
2 changes: 1 addition & 1 deletion examples/ansi/demo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env -S deno run

import * as stdColors from "@std/fmt/colors";
import * as ansiEscapes from "../../ansi/ansi_escapes.ts";
import * as ansiEscapes from "@cliffy/ansi/ansi-escapes";

const ansiEscapeNames1: Array<keyof typeof ansiEscapes> = [
"bel",
Expand Down
2 changes: 1 addition & 1 deletion examples/ansi/functional.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { cursorTo, eraseDown, image, link } from "../../ansi/ansi_escapes.ts";
import { cursorTo, eraseDown, image, link } from "@cliffy/ansi/ansi-escapes";

const response = await fetch("https://deno.land/images/hashrock_simple.png");
const imageBuffer: ArrayBuffer = await response.arrayBuffer();
Expand Down
2 changes: 1 addition & 1 deletion examples/ansi/image.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run --allow-net=deno.land

import { image } from "../../ansi/ansi_escapes.ts";
import { image } from "@cliffy/ansi/ansi-escapes";

const response = await fetch("https://deno.land/images/hashrock_simple.png");
const imageBuffer: ArrayBuffer = await response.arrayBuffer();
Expand Down
2 changes: 1 addition & 1 deletion examples/ansi/link.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env -S deno run --allow-net=deno.land

import { link } from "../../ansi/ansi_escapes.ts";
import { link } from "@cliffy/ansi/ansi-escapes";

console.log(link("Click me.", "https://deno.land"));
2 changes: 1 addition & 1 deletion examples/command.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run --allow-net=localhost:8080,deno.land

import { Command } from "../command/mod.ts";
import { Command } from "@cliffy/command";

await new Command()
.name("reverse-proxy")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/action_handler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/mod.ts";
import { Command } from "@cliffy/command";

await new Command()
.name("rm")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/action_options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

await new Command()
.version("0.1.0")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/arguments_syntax.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

const { args } = await new Command()
.arguments("<input> [output:string]")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/arguments_syntax_variadic.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/mod.ts";
import { Command } from "@cliffy/command";

await new Command()
.command("rmdir <dirs...:string>", "Remove directories.")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/collect_options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

const { options } = await new Command()
.option("-c, --color <color:string>", "read from file ...", { collect: true })
Expand Down
2 changes: 1 addition & 1 deletion examples/command/common_option_types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

const { options } = await new Command()
// Env value must be always required.
Expand Down
2 changes: 1 addition & 1 deletion examples/command/conflicting_options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

const { options } = await new Command()
.option("-f, --file <file:string>", "read from file ...")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/custom_option_processing.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command, ValidationError } from "../../command/mod.ts";
import { Command, ValidationError } from "@cliffy/command";

const { options } = await new Command()
.option(
Expand Down
2 changes: 1 addition & 1 deletion examples/command/custom_option_type.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { ArgumentValue, Command } from "../../command/mod.ts";
import { ArgumentValue, Command } from "@cliffy/command";

const colors = ["red", "blue", "yellow"];

Expand Down
7 changes: 1 addition & 6 deletions examples/command/custom_option_type_class.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#!/usr/bin/env -S deno run

import {
ArgumentValue,
Command,
Type,
ValidationError,
} from "../../command/mod.ts";
import { ArgumentValue, Command, Type, ValidationError } from "@cliffy/command";

class ColorType extends Type<string> {
private readonly colors = ["red", "blue", "yellow"];
Expand Down
2 changes: 1 addition & 1 deletion examples/command/custom_option_type_class_completion.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command, StringType } from "../../command/mod.ts";
import { Command, StringType } from "@cliffy/command";

class EmailType extends StringType {
complete(): string[] {
Expand Down
2 changes: 1 addition & 1 deletion examples/command/custom_option_type_completion.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

await new Command()
.option("-e, --email <value:string:email>", "Your email address.")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/default_option_value.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

const { options } = await new Command()
.option("-c, --cheese [type:string]", "add the specified type of cheese", {
Expand Down
6 changes: 3 additions & 3 deletions examples/command/demo.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { CompletionsCommand } from "../../command/completions/completions_command.ts";
import { HelpCommand } from "../../command/help/help_command.ts";
import { Command } from "@cliffy/command";
import { CompletionsCommand } from "@cliffy/command/completions";
import { HelpCommand } from "@cliffy/command/help";

await new Command()
.name("cliffy")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/depending_options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

const { options } = await new Command()
.option("-u, --audio-codec <type:string>", "description ...")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/dotted_options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

const { options } = await new Command()
.option(
Expand Down
3 changes: 1 addition & 2 deletions examples/command/enum_option_type.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { EnumType } from "../../command/types/enum.ts";
import { Command, EnumType } from "@cliffy/command";

enum Animal {
Dog = "dog",
Expand Down
2 changes: 1 addition & 1 deletion examples/command/environment_variables.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run -A

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

await new Command()
.env("SOME_ENV_VAR=<value:number>", "Description ...")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/environment_variables_override.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run -A

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

await new Command()
.env(
Expand Down
2 changes: 1 addition & 1 deletion examples/command/examples.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env -S deno run

import { Command } from "@cliffy/command";
import { red } from "@std/fmt/colors";
import { Command } from "../../command/command.ts";

await new Command()
.name("examples")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/general_error_handling.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

const cmd = new Command()
.option("-p, --pizza-type <type>", "Flavour of pizza.")
Expand Down
3 changes: 1 addition & 2 deletions examples/command/generic_parent_types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { EnumType } from "../../command/types/enum.ts";
import { Command, EnumType } from "@cliffy/command";

const colorType = new EnumType(["red", "blue"]);

Expand Down
2 changes: 1 addition & 1 deletion examples/command/global_commands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

await new Command()
.command("global [val:string]", "global ...")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/global_custom_type.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command, EnumType } from "../../command/mod.ts";
import { Command, EnumType } from "@cliffy/command";

await new Command()
.globalType("color", new EnumType(["red", "blue", "yellow"]))
Expand Down
2 changes: 1 addition & 1 deletion examples/command/global_options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

await new Command()
.option("-l, --local [val:string]", "Only available on this command.")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/grouped_options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

await new Command()
.version("0.1.0")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/help.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

await new Command()
.name("help-option-and-command")
Expand Down
4 changes: 2 additions & 2 deletions examples/command/help_option_and_command.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env -S deno run

import { HelpCommand } from "../../command/help/help_command.ts";
import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";
import { HelpCommand } from "@cliffy/command/help";

await new Command()
.version("0.1.0")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/hidden_commands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

await new Command()
.command("top-secret", "Nobody knows about me!")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/hidden_options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

await new Command()
.option("-H, --hidden [hidden:boolean]", "Nobody knows about me!", {
Expand Down
2 changes: 1 addition & 1 deletion examples/command/list_option_type.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

const { options } = await new Command()
// comma separated list
Expand Down
2 changes: 1 addition & 1 deletion examples/command/negatable_options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

const { options } = await new Command()
// default value will be automatically set to true if no --check option exists
Expand Down
2 changes: 1 addition & 1 deletion examples/command/options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

const { options } = await new Command()
.option("-s, --silent", "disable output.")
Expand Down
2 changes: 1 addition & 1 deletion examples/command/required_options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

await new Command()
.allowEmpty(false)
Expand Down
4 changes: 2 additions & 2 deletions examples/command/shell-completions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env deno run

import { Command } from "../../command/command.ts";
import { CompletionsCommand } from "../../command/completions/completions_command.ts";
import { Command } from "@cliffy/command";
import { CompletionsCommand } from "@cliffy/command/completions";

await new Command()
.throwErrors()
Expand Down
2 changes: 1 addition & 1 deletion examples/command/standalone_options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env -S deno run

import { Command } from "../../command/command.ts";
import { Command } from "@cliffy/command";

await new Command()
.option("-s, --standalone [value:boolean]", "Some standalone option.", {
Expand Down
Loading
Loading