Skip to content

Commit

Permalink
docs(api): restore docs
Browse files Browse the repository at this point in the history
  • Loading branch information
keindev committed Nov 26, 2021
1 parent 2ed0d90 commit e0692a3
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/api/ProgressBar.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ Increases current progress on step value

#### Parameters

| Name | Type | Description |
| :-------- | :-------------------------------------------------------------------- | :------------------------------------------------------------------------------ |
| `step?` | _number_ | Value by which the current progress will increase |
| `tokens?` | [_IProgressBarToken_](../interfaces/progressbar.iprogressbartoken.md) | Add custom tokens by adding a `{'name': value}` object parameter to your method |
| Name | Type | Description |
| :-------- | :------------------ | :-------------------------------------------------------------------------------------- |
| `step?` | _number_ | Value by which the current progress will increase |
| `tokens?` | _IProgressBarToken_ | Add custom tokens by adding a `{[key: string]: string}` object parameter to your method |

#### Example

```javascript
const bar = new Progress(':bar template with custom :token');

bar.tick(10, { token: 100 });
bar.tick(10, { token: `100` });
```
63 changes: 63 additions & 0 deletions docs/api/Task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Task

Entity for managing a task - includes all child objects (informational messages, errors, progress bars, and tasks)

## Constructor

```typescript
new Task(text?: string, options?: ITaskOptions)
```

#### Parameters

| Name | Type | Description |
| :------------------ | :-------- | :-------------------------------------------------------- |
| `text` | _string_ | Task text message |
| `options.autoClear` | _boolean_ | Removes all subtasks and progress bars after complete |
| `options.status` | _enum_ | New subtask status `(Completed, Failed, Pending,Skipped`) |

## Methods

### add

Create new subtask

### bar

Adds a new progress bar. Returns a progress bar object

### clear

Removes all subtasks and progress bars

### complete

Complete task

### error

Add new task error

### fail

Fail task

### log

Add log message

### render

Render task output

### skip

Skip task

### update

Update task text

### warn

Add task warning
41 changes: 41 additions & 0 deletions docs/api/TaskTree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# TaskTree

Singleton to manage the task tree

## Methods

### add

Adds a new task to the task tree. If there are active tasks, add a new one as a subtask - to the last subtask of the first active task

### exit

Force the process to exit (see process.exit). Do nothing in "silent mode"

### fail

Fail active task or adds a new subtask and call fail on it

### render

Render a task tree into a `string[]`. Returns strings with tasks hierarchy

### start

Starts output a task tree in a terminal at a defined interval. In “silent mode” - the task tree only collects tasks and is not output it in a terminal

### stop

Stop output a task tree in a terminal

### add

Adds a new task to the task tree. If there are active tasks, add a new one as a subtask - to the last subtask of the first active task

### fail

Fail active task or adds a new subtask and call fail on it

### tree

Method to get the object to control the tree (with [Theme](Theme.md))
2 changes: 2 additions & 0 deletions docs/api/Theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ All theme options is object with several fields:
| list || `#4285f4` - symbol || list symbol |
| dim || `#838584` - symbol, bar | `-` | dim color |

> If you use a gradient fill for the progress bar - the color will change from `active` to `success`
```javascript
const theme = {
default: '#ffffff',
Expand Down

0 comments on commit e0692a3

Please sign in to comment.