0.13.7 • Published 3 months ago

libargs v0.13.7

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

libargs

a configurable cli tool.

Install

$ npm i - S libargs

Usage

#!/usr/bin/env node

import { join } from "desm";
import type { CliConfig } from "libargs";

async function main(argv) {
  const { cli } = await import("libargs");

  const cfg: CliConfig = {
    name: "minecat",
    desc: "headline",
    dir: join(import.meta.url, "./src/__tests__/", "fixtures"),
    commands: {
      add: {
        desc: "'Add an integration.'",
        fnName: "ada",
        flags: {
          "--config <path>": "Specify your config file.",
          "--root <path>": "Specify your project root folder.",
        },
      },
      init: {
        desc: "'init an integration.'",
        flags: {
          "--config1 <path>": "Specify your config file.",
          "--root1 <path>": "Specify your project root folder.",
        },
      },
      ada: {
        desc: "'ada an integration.'",
        file: "aba",
        fnName: "ada",
        flags: {
          "--config1 <path>": "Specify your config file.",
          "--root1 <path>": "Specify your project root folder.",
        },
      },
    },
    flags: {
      "--config <path>": "Specify your config file.",
      "--root <path>": "Specify your project root folder.",
      "--site <url>": "Specify your project site.",
    },
  };

  // argv = [];
  await cli(cfg, argv);
}

main(process.argv);

write a file cmd/ada.ts

export function ada(cmd) {
  // cmd.help();
  console.log(cmd);
  const flags = cmd.flags;
  console.dir(flags);
}

Config

cmd

0.13.6

3 months ago

0.13.7

3 months ago

0.13.3

3 months ago

0.13.5

3 months ago

0.11.0

3 months ago

0.12.0

3 months ago

0.10.0

3 months ago

0.9.0

3 months ago

0.8.0

3 months ago

0.7.0

3 months ago

0.6.0

3 months ago

0.5.0

3 months ago

0.4.0

3 months ago

0.3.0

3 months ago

0.2.0

3 months ago

0.1.0

3 months ago