# @familyjs/cli-framework

> The foundation framework of the Family CLI

Latest version **6.0.2** (published 2024-07-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @familyjs/cli-framework
pnpm add @familyjs/cli-framework
yarn add @familyjs/cli-framework
bun add @familyjs/cli-framework
```

## Health

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

Positive: has types; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.0.2 |
| Published | 2024-07-25 |
| First published | 2023-05-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=16.0.0 |
| Dependencies | 15 |
| Unpacked size | 121.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | Family Team |
| Maintainers | nkduy |

## Links

- npm: https://www.npmjs.com/package/@familyjs/cli-framework
- Repository: https://github.com/familyjs/family-cli
- Homepage: https://family-js.web.app/
- Issues: https://github.com/familyjs/family-cli/issues
- npm.io page: https://npm.io/package/@familyjs/cli-framework

## Dependencies (15)

- [chalk](https://npm.io/package/chalk.md) ^4.0.0
- [debug](https://npm.io/package/debug.md) ^4.0.0
- [tslib](https://npm.io/package/tslib.md) ^2.0.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.5
- [rimraf](https://npm.io/package/rimraf.md) ^3.0.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [write-file-atomic](https://npm.io/package/write-file-atomic.md) ^3.0.0
- [@familyjs/utils-fs](https://npm.io/package/@familyjs/utils-fs.md) 3.1.8
- [@familyjs/utils-array](https://npm.io/package/@familyjs/utils-array.md) 2.1.7
- [@familyjs/utils-object](https://npm.io/package/@familyjs/utils-object.md) 2.1.7
- [@familyjs/utils-stream](https://npm.io/package/@familyjs/utils-stream.md) 3.1.8
- [@familyjs/utils-process](https://npm.io/package/@familyjs/utils-process.md) 2.1.13
- [@familyjs/utils-terminal](https://npm.io/package/@familyjs/utils-terminal.md) 2.3.6
- [@familyjs/utils-subprocess](https://npm.io/package/@familyjs/utils-subprocess.md) 3.0.2
- [@familyjs/cli-framework-output](https://npm.io/package/@familyjs/cli-framework-output.md) 2.2.9

## Recent versions

- 6.0.2 (latest) — 2024-07-25
- 5.1.4 — 2023-05-18

## README

# CLI Framework, by Family

The foundation framework of the Family CLI.

## Getting Started

`index.js`:
```js
const { Command, CommandMap, Namespace, execute } = require('@familyjs/cli-framework');

class VersionCommand extends Command {
  async getMetadata() {
    return {
      name: 'version',
      summary: 'Print CLI version',
    };
  }

  async run() {
    console.log('1.0.0');
  }
}

class RootNamespace extends Namespace {
  async getMetadata() {
    return {
      name: 'mynewcli',
      summary: 'A cool CLI that prints its own version',
    };
  }

  async getCommands() {
    return new CommandMap([['version', async () => new VersionCommand(this)]]);
  }
}

module.exports = async function(argv, env) {
  await execute({ namespace: new RootNamespace(), argv, env });
}
```

`bin/mynewcli`:
```javascript
#!/usr/bin/env node

const run = require('../');
run(process.argv.slice(2), process.env);
```

command line:

```bash
$ ./bin/mynewcli
$ ./bin/mynewcli version
$ ./bin/mynewcli version --help
```

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