UNPKG

4.49 kBMarkdownView Raw
1![Stream Cli](https://i.imgur.com/H8AScTq.png)
2
3# Stream CLI
4
5Stream's Command Line Interface (CLI) makes it easy to create and manage your [Stream](https://getstream.io) apps directly from the terminal. Currently, only Chat is supported; however, the ability to manage Feeds will be coming soon.
6
7> **Note**: The latest version of Node (v14.x) is required for this CLI. If you are looking for a way to manage multiple Node.js environments, please look at [nvm](https://github.com/nvm-sh/nvm).
8
9[![Coverage Status](https://coveralls.io/repos/github/GetStream/stream-cli/badge.svg?branch=master)](https://coveralls.io/github/GetStream/stream-cli?branch=master)
10[![Version](https://img.shields.io/npm/v/getstream-cli.svg)](https://npmjs.org/package/getstream-cli)
11[![License](https://img.shields.io/npm/l/getstream-cli.svg)](https://github.com/getstream/stream-cli/blob/master/package.json)
12
13# 🗒 Issues
14
15If you're experiencing problems directly related to the CLI, please add an [issue on GitHub](https://github.com/getstream/stream-cli/issues).
16
17For other issues, submit a [support ticket](https://getstream.io/support).
18
19# 📚 Changelog
20
21As with any project, things are always changing. If you're interested in seeing what's changed in the Stream CLI, the changelog for this project can be found [here](https://github.com/getstream/stream/blob/master/CHANGELOG.md).
22
23# 🏗 Installation
24
25The Stream CLI is easy to install and available via npm. The CLI requires Node v10.x or above.
26
27```sh-session
28$ yarn global add getstream-cli
29```
30
31**OR**
32
33```sh-session
34$ npm install -g getstream-cli
35```
36
37# 🚀 Getting Started
38
39In order to initialize the CLI, it's as simple as:
40
41![Stream](https://i.imgur.com/SA9uMQ1.png)
42
43> Note: Your API key and secret can be found on the [Stream Dashboard](https://getstream.io/dashboard) and is specific to your organization.
44
45# 🔨 Syntax
46
47Basic commands use the following syntax:
48
49```sh-session
50$ stream command:COMMAND --arg1 "foo" --arg2 "bar"
51```
52
53Whereas commands for specific products use subcommands:
54
55```sh-session
56$ stream command:COMMAND:SUBCOMMAND --arg1 "foo" --arg2 "bar"
57```
58
59# 🎩 Fun Facts
60
61Interested in using the calling the CLI from a script? Or maybe you simply want raw response data? You can do that! Many of the commands accept a `json` argument as a `boolean`. Just pass the following along to the CLI and you'll get back a full representation of the response (in a raw data format):
62
63```sh-session
64$ stream command:COMMAND --arg1 "foo" --arg2 "bar" --json
65```
66
67Need to copy the output to your clipboard? Not a problem. Just pipe the information to `pbcopy` (on macOS) along with the `--json` flag:
68
69```sh-session
70$ stream debug:token --token "foo.bar.baz" --json | pbcopy
71```
72
73Want to call the Stream CLI using a bash command? No problem! Make sense of output using [jq](https://stedolan.github.io/jq/), a lightweight and flexible command-line JSON processor.
74
75```bash
76#! /bin/bash
77
78run=$(stream config:get --json)
79
80name=$(jq --raw-output '.name' <<< "${run}")
81email=$(jq --raw-output '.email' <<< "${run}")
82apiKey=$(jq --raw-output '.apiKey' <<< "${run}")
83apiSecret=$(jq --raw-output '.apiSecret' <<< "${run}")
84
85echo $name
86echo $email
87echo $apiKey
88echo $apiSecret
89```
90
91**OR**
92
93```bash
94#! /bin/bash
95
96stream chat:channel:create --channel=$(openssl rand -hex 12) --type="messaging" --name="CLI" --json | jq '.'
97```
98
99> Note: See [here](https://github.com/GetStream/stream-cli/tree/master/examples/bash) for additional examples!
100
101# 🥳‍ Usage
102
103<!-- usage -->
104```sh-session
105$ npm install -g getstream-cli
106$ stream COMMAND
107running command...
108$ stream (-v|--version|version)
109getstream-cli/0.0.63 linux-x64 node-v14.10.0
110$ stream --help [COMMAND]
111USAGE
112 $ stream COMMAND
113...
114```
115<!-- usagestop -->
116
117# 💻 Commands
118
119<!-- commands -->
120# Command Topics
121
122* [`stream autocomplete`](docs/autocomplete.md) - display autocomplete installation instructions
123* [`stream chat`](docs/chat.md) - Adds a member to a channel.
124* [`stream commands`](docs/commands.md) - list all the commands
125* [`stream config`](docs/config.md) - Destroys your user configuration.
126* [`stream debug`](docs/debug.md) - Debugs a JWT token provided by Stream.
127* [`stream help`](docs/help.md) - display help for stream
128
129<!-- commandsstop -->
130
131# 📣 Feedback
132
133If you have any suggestions or just want to let us know what you think of the Stream CLI, please send us a message at support@getstream.io or create a [GitHub Issue](https://github.com/getstream/stream-cli/issues).