# libargs

> a configurable cli tool

Latest version **0.13.7** (published 2024-03-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install libargs
pnpm add libargs
yarn add libargs
bun add libargs
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.13.7 |
| Published | 2024-03-01 |
| First published | 2024-02-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 4.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | npmstudy |
| Maintainers | langshu |
| Keywords | awesome-keywords |

## Links

- npm: https://www.npmjs.com/package/libargs
- npm.io page: https://npm.io/package/libargs

## Dependencies (3)

- [debug](https://npm.io/package/debug.md) ^4.3.4
- [kleur](https://npm.io/package/kleur.md) ^4.1.5
- [yargs-parser](https://npm.io/package/yargs-parser.md) ^21.1.1

## Recent versions

- 0.13.7 (latest) — 2024-03-01
- 0.13.6 — 2024-03-01
- 0.13.5 — 2024-03-01
- 0.13.3 — 2024-03-01
- 0.12.0 — 2024-02-29
- 0.11.0 — 2024-02-29
- 0.10.0 — 2024-02-28
- 0.9.0 — 2024-02-27
- 0.8.0 — 2024-02-27
- 0.7.0 — 2024-02-27
- 0.6.0 — 2024-02-27
- 0.5.0 — 2024-02-27
- 0.4.0 — 2024-02-27
- 0.3.0 — 2024-02-27
- 0.2.0 — 2024-02-27
- … 1 more at https://npm.io/package/libargs/versions

## README

# libargs

a configurable cli tool.

## Install


```sh
$ npm i - S libargs
```

## Usage

```js
#!/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`

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

## Config

- [requied] name: "minecat",
- [requied] desc: "headline",
- [requied] dir: join(import.meta.url, ".", "cmd"),

### cmd

- [requied] desc: "'ada an integration.'",
- [optional] file: "aba",
- [optional] fnName: "ada",
- [optional] flags: {},

---
_Source: https://npm.io/package/libargs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
