3.2.0 • Published 2 years ago

@alterior/command-line v3.2.0

Weekly downloads
78
License
MIT
Repository
github
Last release
2 years ago

@/command-line

Provides a framework for creating command line tools using Alterior. Naturally this is the command line handling library for the Alterior CLI, but it can be used for any sort of command line tool you might need to build.

Getting Started

// src/main.ts

import PKG = require('../package.json');
let line = new CommandLine()
    .info({
        executable: 'my-tool',
        description: 'An example CLI application',
        copyright: 'Copyright 2023 Me',
        version: PKG.version
    })
    .command('frobulate', cmd => {
        cmd .info({
                description: 'Frobulate the given value',
                argumentUsage: '<value>'
            })
            .run(([ value ]) => {
                console.log(`You have frobulated ${value}!`);
            })
        ;
    })
    .run(() => line.showHelp());
;

line.process();