Skip to main content

Command

Enum Command 

Source
pub enum Command {
    Doctor {
        input: PathBuf,
        only: Option<CapabilityArg>,
        strict: bool,
        format: FormatArg,
    },
    Dev {
        path: PathBuf,
        contexts: Vec<String>,
        base_port: Option<u16>,
        inspect: bool,
        inspect_port: u16,
        env: String,
        wrangler_args: Vec<String>,
    },
    Deploy {
        path: PathBuf,
        context: Option<String>,
        env: String,
        dry_run: bool,
        format: DeployFormatArg,
        yes: bool,
        secrets_file: Option<PathBuf>,
        secrets: Vec<String>,
        force: bool,
        prune: bool,
        wrangler_args: Vec<String>,
    },
    New {
        path: PathBuf,
        name: Option<String>,
    },
    Check {
        input: PathBuf,
        format: CheckFormatArg,
    },
    Fmt {
        args: FmtArgs,
    },
    Test {
        args: TestArgs,
    },
    Explain {
        code: String,
    },
}

Variants§

§

Doctor

Check whether your machine is ready to compile, test, and deploy Bynk — and print the exact remedy for anything missing.

Bare bynk doctor is informational: it surveys every capability and exits 0 unless bynkc itself is unusable. --only <capability> gates on one capability (exits non-zero if its tools are missing); --strict turns every warning into a failure, for CI.

Fields

§input: PathBuf

Project directory to inspect (for project-local node_modules/.bin resolution). Defaults to the current directory.

§only: Option<CapabilityArg>

Scope the check — and the exit code — to one capability.

§strict: bool

Treat every warning (optional gaps, npx provisionability, minor version skew) as a failure. For an all-green CI gate.

§format: FormatArg

Output format. human (default) is a grouped table; short and json are the stable scriptable surface.

§

Dev

Build the project and serve it locally with wrangler dev, rebuilding on save — one step in place of the manual compile + cd + wrangler dev recipe.

Compiles into a managed .bynk/dev/ build dir and runs one wrangler dev per context from inside its worker dir, in local mode (Miniflare) — no namespace provisioning needed. Every context is served by default and the service bindings between them are wired (#552), so a cross-context call resolves locally; --context narrows to a subset. While serving, .bynk sources are watched (#524): saving a file rebuilds in place and the running workers hot-reload; a failing rebuild reports errors and keeps serving the last good build. Everything after -- is forwarded to wrangler dev verbatim.

Fields

§path: PathBuf

Project directory to serve from (anywhere inside the project; the root is found by walking up for bynk.toml). Defaults to ..

§contexts: Vec<String>

Which context to serve, repeatable. Omit to serve every context in the project with the service bindings between them wired (#552); pass one or more to narrow to a subset. Accepts the dotted name or its dasherised worker-dir form.

§base_port: Option<u16>

First port of the per-context allocation (context i gets --base-port + i, in sorted order). Defaults to wrangler’s 8787. A single context left on the default keeps -- --port N working.

§inspect: bool

Serve with the V8 inspector enabled (slice 3, ADR 0104): wrangler dev starts with --inspector-port so a JavaScript debugger can attach. Breakpoints set in .bynk sources resolve through the emitted source maps, composed into the worker bundle. Prints the inspector URL on start.

§inspect_port: u16

First inspector port for --inspect, allocated per context exactly as --base-port is (default 9229).

§env: String

Which bynk.deploy.lock environment -- --remote reads the KV id from. dev never provisions, so this only selects among what bynk deploy --env NAME already recorded — irrelevant without --remote. Omit for today’s single, unqualified default.

§wrangler_args: Vec<String>

Arguments after --, forwarded to wrangler dev (e.g. -- --remote). Ports are the driver’s to allocate: use --base-port / --inspect-port.

§

Deploy

Provision each context’s Cloudflare resources and deploy its Worker. The whole project ships in one command, in Service-Binding dependency order — Cloudflare rejects a Worker uploaded before a Worker it binds to. The generated configuration remains disposable: Cloudflare ids live in the committed bynk.deploy.lock.

Fields

§path: PathBuf

Project directory to deploy from. Defaults to the current directory.

§context: Option<String>

Deploy this context alone, assuming the contexts it consumes are already live; a dependency that has never been deployed is reported rather than pushed into. Accepts the dotted name or its dasherised worker-dir form. Omit to deploy the whole project in order.

§env: String

Target environment. Selects the bynk.deploy.lock section and, for any value other than default, synthesises an environment- scoped Wrangler config section (KV, queues, Service Bindings all qualified) since Cloudflare does not inherit bindings into a named environment. Omit to deploy today’s single, unqualified default.

§dry_run: bool

Print the provisioning and deploy plan without changing Cloudflare or writing bynk.deploy.lock.

§format: DeployFormatArg

Plan output format. short is line-oriented; json is for CI.

§yes: bool

Skip the confirmation required before creating a namespace or publishing a Worker. Required for non-interactive automation.

§secrets_file: Option<PathBuf>

Read secret values from a dotenv-style NAME=value file. Supplies both names and values; never committed, never persisted. Values move to wrangler secret put and are dropped.

§secrets: Vec<String>

Set this named secret, taking its value from the environment (or a prompt). Repeatable. Use for a bynk.Secrets name, whose spelling the compiler cannot know — an actor’s declared auth secret needs no flag. The environment is never scanned for names.

§force: bool

Overwrite a secret that is already set. The default sets only the missing ones, so a re-deploy does not cut a fresh Cloudflare secret version for every secret every time.

§prune: bool

Delete every reported orphan — a KV namespace or queue the ledger remembers that the current build no longer declares. Never deletes a Worker. Prompts separately from the creation confirmation unless –yes is also given; omit to report only.

§wrangler_args: Vec<String>

Arguments after --, forwarded to wrangler deploy verbatim.

§

New

Scaffold a new project: a complete, runnable single-context HTTP service you can serve immediately with bynk dev.

Writes a bynk.toml, a .gitignore, and src/<name>.bynk into a new directory. Pure offline file-writing — it shells nothing and needs no toolchain, so you can run it before bynkc, Node, or wrangler are installed. The project name defaults to the target directory’s final component; --name overrides it and must be a legal Bynk identifier.

Fields

§path: PathBuf

Directory to create for the new project (e.g. hello or ./hello).

§name: Option<String>

Project name / context identifier. Defaults to PATH’s final component; must be a legal Bynk identifier (a letter followed by letters, digits, or underscores).

§

Check

Type-check a .bynk file or project without writing output — the bynkc check behaviour through the driver’s compiler resolution (v0.138).

Runs the compiler pipeline in-process (no bynkc binary required); with BYNK_BYNKC set, the pinned compiler is shelled instead so an externally-managed bynkc still governs the result.

Fields

§input: PathBuf

Input .bynk file or project root. Defaults to the current directory.

§format: CheckFormatArg

Diagnostic output format. rich (default) is the ariadne source-context rendering; short emits one terse path:line:col: severity[category]: message line per diagnostic, for tooling (the VS Code problem-matcher, CI, scripts).

§

Fmt

Format .bynk source files in place — the bynkc fmt behaviour through the driver (v0.138). Passing - reads from stdin and writes to stdout.

Runs the formatter in-process (no bynkc binary required); with BYNK_BYNKC set, the pinned compiler is shelled instead — the style flags are forwarded to it either way.

--indent, --indent-width, --max-line-width and --no-trailing-comma override the canonical style for this run; with none of them the output is the canonical formatting.

Fields

§args: FmtArgs
§

Test

Discover and run test declarations in a project — the bynkc test behaviour through the driver (v0.138).

Delegates to the bynkc the driver resolves (BYNK_BYNKC → PATH → sibling-of-bynk), so an editor or developer inherits the driver’s richer compiler resolution instead of locating bynkc themselves. Requires tsc (with Node.js) or tsx on PATH, exactly as bynkc test.

Fields

§args: TestArgs
§

Explain

Explain a diagnostic code — the longer-form “what the rule is, why it exists, and how to fix it” behind a bynk.* error code (#853).

Prints a curated blurb, a minimal before/after example, and a link to the relevant Book concept page. The blurb is offline-complete, so the substance is available without network. Codes without a curated explanation report that gracefully; an unrecognised code exits non-zero. The same explanations back the editor’s clickable diagnostic-code links.

Fields

§code: String

The diagnostic code to explain, e.g. bynk.resolve.unknown_type.

Trait Implementations§

Source§

impl Debug for Command

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromArgMatches for Command

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Subcommand for Command

Source§

fn augment_subcommands<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via [FromArgMatches::from_arg_matches_mut] Read more
Source§

fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via [FromArgMatches::update_from_arg_matches_mut] Read more
Source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Paint for T
where T: ?Sized,

§

fn fg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the foreground set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like red() and green(), which have the same functionality but are pithier.

§Example

Set foreground color to white using fg():

use yansi::{Paint, Color};

painted.fg(Color::White);

Set foreground color to white using white().

use yansi::Paint;

painted.white();
§

fn primary(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Primary].

§Example
println!("{}", value.primary());
§

fn fixed(&self, color: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Fixed].

§Example
println!("{}", value.fixed(color));
§

fn rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Rgb].

§Example
println!("{}", value.rgb(r, g, b));
§

fn black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Black].

§Example
println!("{}", value.black());
§

fn red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Red].

§Example
println!("{}", value.red());
§

fn green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Green].

§Example
println!("{}", value.green());
§

fn yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Yellow].

§Example
println!("{}", value.yellow());
§

fn blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Blue].

§Example
println!("{}", value.blue());
§

fn magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Magenta].

§Example
println!("{}", value.magenta());
§

fn cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Cyan].

§Example
println!("{}", value.cyan());
§

fn white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: White].

§Example
println!("{}", value.white());
§

fn bright_black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlack].

§Example
println!("{}", value.bright_black());
§

fn bright_red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightRed].

§Example
println!("{}", value.bright_red());
§

fn bright_green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightGreen].

§Example
println!("{}", value.bright_green());
§

fn bright_yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightYellow].

§Example
println!("{}", value.bright_yellow());
§

fn bright_blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlue].

§Example
println!("{}", value.bright_blue());
§

fn bright_magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.bright_magenta());
§

fn bright_cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightCyan].

§Example
println!("{}", value.bright_cyan());
§

fn bright_white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightWhite].

§Example
println!("{}", value.bright_white());
§

fn bg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the background set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like on_red() and on_green(), which have the same functionality but are pithier.

§Example

Set background color to red using fg():

use yansi::{Paint, Color};

painted.bg(Color::Red);

Set background color to red using on_red().

use yansi::Paint;

painted.on_red();
§

fn on_primary(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Primary].

§Example
println!("{}", value.on_primary());
§

fn on_fixed(&self, color: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Fixed].

§Example
println!("{}", value.on_fixed(color));
§

fn on_rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Rgb].

§Example
println!("{}", value.on_rgb(r, g, b));
§

fn on_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Black].

§Example
println!("{}", value.on_black());
§

fn on_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Red].

§Example
println!("{}", value.on_red());
§

fn on_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Green].

§Example
println!("{}", value.on_green());
§

fn on_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Yellow].

§Example
println!("{}", value.on_yellow());
§

fn on_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Blue].

§Example
println!("{}", value.on_blue());
§

fn on_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Magenta].

§Example
println!("{}", value.on_magenta());
§

fn on_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Cyan].

§Example
println!("{}", value.on_cyan());
§

fn on_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: White].

§Example
println!("{}", value.on_white());
§

fn on_bright_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlack].

§Example
println!("{}", value.on_bright_black());
§

fn on_bright_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightRed].

§Example
println!("{}", value.on_bright_red());
§

fn on_bright_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightGreen].

§Example
println!("{}", value.on_bright_green());
§

fn on_bright_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightYellow].

§Example
println!("{}", value.on_bright_yellow());
§

fn on_bright_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlue].

§Example
println!("{}", value.on_bright_blue());
§

fn on_bright_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.on_bright_magenta());
§

fn on_bright_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightCyan].

§Example
println!("{}", value.on_bright_cyan());
§

fn on_bright_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightWhite].

§Example
println!("{}", value.on_bright_white());
§

fn attr(&self, value: Attribute) -> Painted<&T>

Enables the styling [Attribute] value.

This method should be used rarely. Instead, prefer to use attribute-specific builder methods like bold() and underline(), which have the same functionality but are pithier.

§Example

Make text bold using attr():

use yansi::{Paint, Attribute};

painted.attr(Attribute::Bold);

Make text bold using using bold().

use yansi::Paint;

painted.bold();
§

fn bold(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Bold].

§Example
println!("{}", value.bold());
§

fn dim(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Dim].

§Example
println!("{}", value.dim());
§

fn italic(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Italic].

§Example
println!("{}", value.italic());
§

fn underline(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Underline].

§Example
println!("{}", value.underline());

Returns self with the attr() set to [Attribute :: Blink].

§Example
println!("{}", value.blink());

Returns self with the attr() set to [Attribute :: RapidBlink].

§Example
println!("{}", value.rapid_blink());
§

fn invert(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Invert].

§Example
println!("{}", value.invert());
§

fn conceal(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Conceal].

§Example
println!("{}", value.conceal());
§

fn strike(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Strike].

§Example
println!("{}", value.strike());
§

fn quirk(&self, value: Quirk) -> Painted<&T>

Enables the yansi [Quirk] value.

This method should be used rarely. Instead, prefer to use quirk-specific builder methods like mask() and wrap(), which have the same functionality but are pithier.

§Example

Enable wrapping using .quirk():

use yansi::{Paint, Quirk};

painted.quirk(Quirk::Wrap);

Enable wrapping using wrap().

use yansi::Paint;

painted.wrap();
§

fn mask(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Mask].

§Example
println!("{}", value.mask());
§

fn wrap(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Wrap].

§Example
println!("{}", value.wrap());
§

fn linger(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Linger].

§Example
println!("{}", value.linger());
§

fn clear(&self) -> Painted<&T>

👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear(). The clear() method will be removed in a future release.

Returns self with the quirk() set to [Quirk :: Clear].

§Example
println!("{}", value.clear());
§

fn resetting(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Resetting].

§Example
println!("{}", value.resetting());
§

fn bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Bright].

§Example
println!("{}", value.bright());
§

fn on_bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: OnBright].

§Example
println!("{}", value.on_bright());
§

fn whenever(&self, value: Condition) -> Painted<&T>

Conditionally enable styling based on whether the [Condition] value applies. Replaces any previous condition.

See the crate level docs for more details.

§Example

Enable styling painted only when both stdout and stderr are TTYs:

use yansi::{Paint, Condition};

painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
§

fn new(self) -> Painted<Self>
where Self: Sized,

Create a new [Painted] with a default [Style]. Read more
§

fn paint<S>(&self, style: S) -> Painted<&Self>
where S: Into<Style>,

Apply a style wholesale to self. Any previous style is replaced. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.