Skip to content

Commit

Permalink
docs: improves explanation of list command.
Browse files Browse the repository at this point in the history
  • Loading branch information
outofcoffee committed Sep 4, 2023
1 parent 465de13 commit 0a1a53c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ Example:
Usage:

```
Lists running Imposter mocks for the current engine type.
Lists running Imposter mocks for the current engine type
and reports their health.
Usage:
imposter list [flags]
Expand All @@ -297,6 +298,22 @@ Flags:
-q, --quiet Quieten output; only print ID
```

#### Using as a healthcheck

You can use the `list` command as a healthcheck for running mocks.

```shell
$ imposter list --quiet --exit-code-health
```

This will return an exit code of `0` (success) if one or more mocks are running and healthy. If no mocks are running, or if one or more mock is unhealthy, a non-zero exit code will be returned.

> **Note**
> You can use the short versions of the arguments, so this can also be written:
> ```shell
> imposter list -qx
> ```
### Install plugin
Example:
Expand Down
3 changes: 2 additions & 1 deletion cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ var listCmd = &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Short: "List running mocks",
Long: `Lists running Imposter mocks for the current engine type.`,
Long: `Lists running Imposter mocks for the current engine type
and reports their health.`,
Run: func(cmd *cobra.Command, args []string) {
listMocks(engine.GetConfiguredType(listFlags.engineType), listFlags.quiet)
},
Expand Down

0 comments on commit 0a1a53c

Please sign in to comment.