@akiojin/argument-builder
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

argument-builder

This package implements a class that creates command line parameters.

Usage

import { ArgumentBuilder } from '@akiojin/argument-builder'
const builder = new ArgumentBuilder()
builder
    .Append('--verbose')
    .Append('--file', 'log.txt')
    .Append([ '--output', './out' ])
await execa.execa('foo', builder.Build())

Reference

class ArgumentBuilder

Append(arg: string | string[], param?: string): void

Description

Add an argument.

Arguments
Name Type Description
arg string | string[] Commands to pass to command line
param? string Parameters to be added to the command

Count(): number

Description

Returns the number of arguments added.

Return
Type Description
number Number of arguments

Build(): string[]

Description

Returns an array of arguments to be passed to the command line.

Return
Type Description
string[] Argument array

ToString(): string

Description

Return arguments as a single space-delimited string

Return
Type Description
string Return arguments as a single space-delimited string

Readme

Keywords

Package Sidebar

Install

npm i @akiojin/argument-builder

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

6.85 kB

Total Files

5

Last publish

Collaborators

  • akiojin