How to use the @swim/args.Arg.of function in @swim/args

To help you get started, we’ve selected a few @swim/args examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github swimos / swim / swim-system-js / swim-mesh-js / @swim / cli / main / index.ts View on Github external
const reflectLogCmd = Cmd.of("log")
    .desc("stream log events")
    .opt(Opt.of("trace").flag("t").desc("stream trace log messages"))
    .opt(Opt.of("debug").flag("d").desc("stream debug log messages"))
    .opt(Opt.of("info").flag("i").desc("stream info log messages"))
    .opt(Opt.of("warn").flag("w").desc("stream warning log messages"))
    .opt(Opt.of("error").flag("e").desc("stream error log messages"))
    .helpCmd()
    .exec(runReflectLog);

const reflectCmd = Cmd.of("reflect")
    .desc("stream introspection metadata")
    .opt(Opt.of("edge").flag("e").arg("edgeUri").desc("endpoint to introspect"))
    .opt(Opt.of("mesh").flag("m").arg(Arg.of("meshUri").optional(true)).desc("introspect default or specified mesh"))
    .opt(Opt.of("part").flag("p").arg(Arg.of("partKey").optional(true)).desc("introspect default or specified partition"))
    .opt(Opt.of("host").flag("h").arg(Arg.of("hostUri").optional(true)).desc("introspect default or specified host"))
    .opt(Opt.of("node").flag("n").arg("nodeUri").desc("introspect specified node"))
    .opt(Opt.of("lane").flag("l").arg("laneUri").desc("introspect specified lane"))
    .opt(Opt.of("link").flag("k").desc("introspect link behavior"))
    .opt(Opt.of("router").flag("r").desc("introspect router behavior"))
    .opt(Opt.of("data").desc("introspect data behavior"))
    .opt(Opt.of("system").desc("introspect system behavior"))
    .opt(Opt.of("process").desc("introspect process behavior"))
    .opt(Opt.of("stats").flag("s").desc("stream introspection statistics"))
    .opt(Opt.of("format").flag("f").arg("json|recon").desc("event output format"))
    .cmd(reflectLogCmd)
    .helpCmd()
    .exec(runReflect);

const cmd = Cmd.of("swim-cli")
    .cmd(linkCmd)
    .cmd(syncCmd)
github swimos / swim / swim-system-js / swim-core-js / @swim / build / main / cli.ts View on Github external
.opt(Opt.of("tests").arg("pattern").desc("only run tests whose names match this pattern"))
    .opt(Opt.of("doc").desc("build documentation after successful compilation"))
    .exec(runWatch);

const updateCmd: Cmd = Cmd.of("update")
    .desc("update package versions to match build config")
    .opt(Opt.of("projects").flag("p").arg("project(,project)*").desc("comma-separated list of projects to update"))
    .exec(runUpdate);

const cleanCmd: Cmd = Cmd.of("clean")
    .desc("delete generated files")
    .opt(Opt.of("projects").flag("p").arg("project(,project)*").desc("comma-separated list of projects to clean"))
    .exec(runClean);

export const cli = Cmd.of("build")
    .opt(Opt.of("config").flag("c").arg(Arg.of("build.config.js").value("build.config.js").optional(true)).desc("build config script path"))
    .cmd(projectsCmd)
    .cmd(targetsCmd)
    .cmd(compileCmd)
    .cmd(testCmd)
    .cmd(docCmd)
    .cmd(watchCmd)
    .cmd(updateCmd)
    .cmd(cleanCmd)
    .helpCmd();
github swimos / swim / swim-system-js / swim-mesh-js / @swim / cli / main / index.ts View on Github external
const reflectLogCmd = Cmd.of("log")
    .desc("stream log events")
    .opt(Opt.of("trace").flag("t").desc("stream trace log messages"))
    .opt(Opt.of("debug").flag("d").desc("stream debug log messages"))
    .opt(Opt.of("info").flag("i").desc("stream info log messages"))
    .opt(Opt.of("warn").flag("w").desc("stream warning log messages"))
    .opt(Opt.of("error").flag("e").desc("stream error log messages"))
    .helpCmd()
    .exec(runReflectLog);

const reflectCmd = Cmd.of("reflect")
    .desc("stream introspection metadata")
    .opt(Opt.of("edge").flag("e").arg("edgeUri").desc("endpoint to introspect"))
    .opt(Opt.of("mesh").flag("m").arg(Arg.of("meshUri").optional(true)).desc("introspect default or specified mesh"))
    .opt(Opt.of("part").flag("p").arg(Arg.of("partKey").optional(true)).desc("introspect default or specified partition"))
    .opt(Opt.of("host").flag("h").arg(Arg.of("hostUri").optional(true)).desc("introspect default or specified host"))
    .opt(Opt.of("node").flag("n").arg("nodeUri").desc("introspect specified node"))
    .opt(Opt.of("lane").flag("l").arg("laneUri").desc("introspect specified lane"))
    .opt(Opt.of("link").flag("k").desc("introspect link behavior"))
    .opt(Opt.of("router").flag("r").desc("introspect router behavior"))
    .opt(Opt.of("data").desc("introspect data behavior"))
    .opt(Opt.of("system").desc("introspect system behavior"))
    .opt(Opt.of("process").desc("introspect process behavior"))
    .opt(Opt.of("stats").flag("s").desc("stream introspection statistics"))
    .opt(Opt.of("format").flag("f").arg("json|recon").desc("event output format"))
    .cmd(reflectLogCmd)
    .helpCmd()
    .exec(runReflect);

const cmd = Cmd.of("swim-cli")
    .cmd(linkCmd)
github swimos / swim / swim-system-js / swim-mesh-js / @swim / cli / main / index.ts View on Github external
.exec(runGet);

const reflectLogCmd = Cmd.of("log")
    .desc("stream log events")
    .opt(Opt.of("trace").flag("t").desc("stream trace log messages"))
    .opt(Opt.of("debug").flag("d").desc("stream debug log messages"))
    .opt(Opt.of("info").flag("i").desc("stream info log messages"))
    .opt(Opt.of("warn").flag("w").desc("stream warning log messages"))
    .opt(Opt.of("error").flag("e").desc("stream error log messages"))
    .helpCmd()
    .exec(runReflectLog);

const reflectCmd = Cmd.of("reflect")
    .desc("stream introspection metadata")
    .opt(Opt.of("edge").flag("e").arg("edgeUri").desc("endpoint to introspect"))
    .opt(Opt.of("mesh").flag("m").arg(Arg.of("meshUri").optional(true)).desc("introspect default or specified mesh"))
    .opt(Opt.of("part").flag("p").arg(Arg.of("partKey").optional(true)).desc("introspect default or specified partition"))
    .opt(Opt.of("host").flag("h").arg(Arg.of("hostUri").optional(true)).desc("introspect default or specified host"))
    .opt(Opt.of("node").flag("n").arg("nodeUri").desc("introspect specified node"))
    .opt(Opt.of("lane").flag("l").arg("laneUri").desc("introspect specified lane"))
    .opt(Opt.of("link").flag("k").desc("introspect link behavior"))
    .opt(Opt.of("router").flag("r").desc("introspect router behavior"))
    .opt(Opt.of("data").desc("introspect data behavior"))
    .opt(Opt.of("system").desc("introspect system behavior"))
    .opt(Opt.of("process").desc("introspect process behavior"))
    .opt(Opt.of("stats").flag("s").desc("stream introspection statistics"))
    .opt(Opt.of("format").flag("f").arg("json|recon").desc("event output format"))
    .cmd(reflectLogCmd)
    .helpCmd()
    .exec(runReflect);

const cmd = Cmd.of("swim-cli")

@swim/args

Composable command line argument parser

Apache-2.0
Latest version published 5 months ago

Package Health Score

68 / 100
Full package analysis

Similar packages