# toguru-panel-cli

> Queries toggles for cultures and includes helper methods

Latest version **1.0.5** (published 2018-06-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install toguru-panel-cli
pnpm add toguru-panel-cli
yarn add toguru-panel-cli
bun add toguru-panel-cli
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2018-06-25 |
| First published | 2017-12-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 17.5 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| Author | Conor Brady |
| Maintainers | autoscout24 |

## Links

- npm: https://www.npmjs.com/package/toguru-panel-cli
- Repository: https://github.com/AutoScout24/toguru-panel-cli
- Homepage: https://github.com/AutoScout24/toguru-panel-cli#readme
- Issues: https://github.com/AutoScout24/toguru-panel-cli/issues
- npm.io page: https://npm.io/package/toguru-panel-cli

## Dependencies (4)

- [rxjs](https://npm.io/package/rxjs.md) ^5.5.2
- [axios](https://npm.io/package/axios.md) ^0.17.0
- [yargs](https://npm.io/package/yargs.md) ^10.0.3
- [underscore](https://npm.io/package/underscore.md) ^1.8.3

## Recent versions

- 1.0.5 (latest) — 2018-06-25
- 1.0.4 — 2017-12-11
- 1.0.3 — 2017-12-11

## README

# toguru-panel-cli
Filter exsting toguru toggles by property values

## Setup up
1. Run `npm install toguru-panel-cli --save` in your project
   
## Configure & Use Toguru.js
1. Include `toguru-panel-cli` in your project with `const Toguru = require('toguru-panel-cli')`
2. Create a Toguru object with `const toguru = Toguru(toguruToken)`
   - Where `toguruToken` is your decrypted toguru token string.
3. Call `toguru.toggles()` to receive an `Observable` of all toggles, and chain any filter predicates you want
4. Chain `.subscribe(toguru.sink)` to your last observable filter operation to pretty print the resulting JSON
   
## Examples
Run the included example with `node example.js -t <your-toguru-token>`. 

Analagous to an `SQL` query, it:

"selects" toggles where 
   - the toggle's team is `gecloud`
   - the toggle is fully rolled out
   - the toggle is defined for the `classified-detail` service.
   
```
toguru.toggles()                                        // SELECT * FROM TOGGLES
    .filter(toguru.teamToggles("gecloud"))              // WHERE (TOGGLES.TEAM = "gecloud"
    .filter(toguru.fullRollout)                         // AND TOGGLES.ROLLOUT_PERCENTAGE = 100
    .filter(toguru.toggleServices("classified-detail")) // AND TOGGLES.SERVICES = "classified-detail)"
    .subscribe(toguru.sink);                            // pretty prints result(s) to STDOUT
```

## Running tests
1. `npm run test`

## Extend or write your own filters
To do this, write a predicate function that accepts a toggle object and returns true or false, and filter the toggles based on your predicate. 
  - E.g. `toguru.toggles().filter((toggle) => toggle.id === "my-toggle-id")`
  
## Contributing to the existing library
1. Make a pull request with your changes describing **what** it does and **why** it is applicable to the general user base
2. All library functionality should live in `/lib/toguru.js`, and extend the existing API
3. Include tests for your new changes and make sure all old and new tests run with `npm run test`
  
### Toggle JSON structure

#### Warning: some toggles are missing fields since they are user defined. Be sure to be aware of this when writing your own filters
```
{
	"id": "<toggle-id>",
	"tags": {
		"team": "<team-name>",
		"stack": "<stack-name>",
		"services": "<service-name(s)>"
	},
	"rolloutPercentage": <[0 - 100]>
}
```

---
_Source: https://npm.io/package/toguru-panel-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
