Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akiojin/argument-builder
https://github.com/akiojin/argument-builder
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/akiojin/argument-builder
- Owner: akiojin
- Created: 2022-03-16T09:50:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-28T02:37:09.000Z (9 months ago)
- Last Synced: 2024-10-20T01:47:34.735Z (29 days ago)
- Language: TypeScript
- Size: 718 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# argument-builder
This package implements a class that creates command line parameters.## Usage
```js
import { ArgumentBuilder } from '@akiojin/argument-builder'
```
```js
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): ArgumentBuilder`
##### 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|##### Return
|Type|Description|
|:--|:--|
|`ArgumentBuilder`|Return this|#### `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|