Socket
Socket
Sign inDemoInstall

@saithodev/cli-base

Package Overview
Dependencies
6
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @saithodev/cli-base

Base for a CLI-based NPM package


Version published
Weekly downloads
7
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

2.3.3 (2023-11-29)

Bug Fixes

  • export request (709c717)

Readme

Source

@saithodev/cli-base

Build Status npm version Coverage semantic-release Commitizen friendly

This package provides a basic API for creating CLI-based packages.

Example

The following example will add two commands "help" and "version".

index.ts

import {Cli, HelpCommand, VersionCommand} from "@saithodev/cli-base";

new Cli('typo3-extension-release')
    .setOptions({
        'dry-run': {
            type: 'boolean',
            default: false,
            alias: 'd',
            description: 'Simulates changes without writing them'
        }
    })
    .addCommand(new HelpCommand()) // adds help command
    .addCommand(new VersionCommand()) // adds version command
    .run()
    .catch((error) => {
        console.error(error);
        process.exit(1);
    });

Compile sources and test it with dist/index.js help and dist/index.js version.

For details on how to implement custom commands, take a closer look at the example and the command classes used there.

Keywords

FAQs

Last updated on 29 Nov 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc