---
# System prepended metadata

title: Plan ClI

---

# Plan ClI
## Alias
```bash
alias planctl="python3 /{path}/app.py"
```
## Commands
- `add`: add a new plan schedule
- `delete`: delete a scheduled plans
- `logs`: print the logs of a scheduled plan
- `list`: list the status of scheduled plans in specific day

### Add new plan schedule
```bash
planctl add {-n PLAN_NAME | --name PLAN_NAME | -i PLAN_ID | --id PLAN_ID} [-m REPEATE_MODE | --mode REPEATE_MODE] [-d DAY | --day DAY] [-h HOUR | --hour HOUR]
```

#### Options
| Options       | Description                          | Default | Values                       |
| ------------- | ------------------------------------ | :-----: | :--------------------------: |
| `-n` `--name` | Plan name (`case sensitive`)         | --      | --                           |
| `-i` `--id`   | Plan id                              | --      | --                           |
| `-m` `--mode` | Repeat mode                          | `Daily` | `Daily`, `D`, `Monthly`, `M` |
| `-d` `--day`  | Day of month for `Monthly` mode only | `1`     | min: `1` and max: `28`       |
| `-h` `--hour` | Hour of day                          | `0`     | min: `0` and max: `23`       |

#### Outputs
- Success
```
Success: Plan {plan-name} has beed scheduled monthly on {day} at {hour}
Success: Plan {plan-name} has beed scheduled daily at {hour}
```
- Error
```
Error: {Argument validation error}
Error: {Error message from backend}
```

### Delete scheduled plan
```bash
planctl delete {-n PLAN_NAME | --name PLAN_NAME}
```

#### Options
| Options       | Description                  | Default | Values |
| ------------- | ---------------------------- | :-----: | :----: |
| `-n` `--name` | Plan name (`case sensitive`) | --      | --     |

#### Outputs
- Success
```
Success: Plan {plan-name} has beed deleted
```

- Error
```
Error: {Argument validation error}
Error: {Error message from backend}
```

### Print scheduled plan logs
```bash
planctl logs {-n PLAN_NAME | --name PLAN_NAME | -i PLAN_ID | --id PLAN_ID}
```

#### Options
| Options       | Description                          | Default | Values |
| ------------- | ------------------------------------ | :-----: | :----: |
| `-n` `--name` | Plan name (`case sensitive`)         | --      | --     |
| `-i` `--id`   | Plan id                              | --      | --     |

#### Outputs
- Success
```
Success: Plan {plan-name} logs
..............
..............
.... logs ....
..............
..............
```

- Error
```
Error: {Argument validation error}
Error: {Error message from backend}
```

### List scheduled plans status
```bash
planctl list [-o NUMBER | --offset NUMBER] [-s STATUS | --status STATUS]
```

#### Options
| Options         | Description                                                    | Default | Values                                                   |
| --------------- | -------------------------------------------------------------- | :-----: | :------------------------------------------------------: |
| `-o` `--offset` | Get historical status <br> Ex: `offset=1` status of yesterday. | `0`     | --                                                       |
| `-s` `--status` | Filter plans by status                                         | `All`   | `All`, `Success`, `Failed`, <br> `Scheduled`, `Enqueued` |


#### Outputs
- Success
```
┌─────┬────────┬──────────────────────┬─────────┐
│ Id  │ Name   │ Schedule             │ Status  │
├─────┼────────┼──────────────────────┼─────────┤
│  1  │ Plan A │ Daily at 12 am       │ Success │
│  2  │ Plan B │ Monthlty on 28 at 12 │ Failed  │
└─────┴────────┴──────────────────────┴─────────┘
```

- Error
```
Error: {Argument validation error}
Error: {Error message from backend}
```


