1.0.0 • Published 2 years ago

@akiojin/argument-builder v1.0.0

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

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
NameTypeDescription
argstring | string[]Commands to pass to command line
param?stringParameters to be added to the command

Count(): number

Description

Returns the number of arguments added.

Return
TypeDescription
numberNumber of arguments

Build(): string[]

Description

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

Return
TypeDescription
string[]Argument array

ToString(): string

Description

Return arguments as a single space-delimited string

Return
TypeDescription
stringReturn arguments as a single space-delimited string