1 | ![Stream Cli](https://i.imgur.com/H8AScTq.png)
|
2 |
|
3 | # Stream CLI
|
4 |
|
5 | Stream'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 | [![Coverage Status](https://coveralls.io/repos/github/GetStream/stream-cli/badge.svg?branch=master)](https://coveralls.io/github/GetStream/stream-cli?branch=master)
|
8 | [![Version](https://img.shields.io/npm/v/getstream-cli.svg)](https://npmjs.org/package/getstream-cli)
|
9 | [![Dependency Status](https://david-dm.org/getstream/stream-cli/status.svg)](https://david-dm.org/getstream/stream-cli)
|
10 | [![devDependency Status](https://david-dm.org/getstream/stream-cli/dev-status.svg)](https://david-dm.org/getstream/stream-cli?type=dev)
|
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 |
|
15 | If you're experiencing problems directly related to the CLI, please add an [issue on GitHub](https://github.com/getstream/stream-cli/issues).
|
16 |
|
17 | For other issues, submit a [support ticket](https://getstream.io/support).
|
18 |
|
19 | # 📚 Changelog
|
20 |
|
21 | As 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 |
|
25 | The 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 |
|
39 | In 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 |
|
47 | Basic commands use the following syntax:
|
48 |
|
49 | ```sh-session
|
50 | $ stream command:COMMAND --arg1 "foo" --arg2 "bar"
|
51 | ```
|
52 |
|
53 | Whereas 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 |
|
61 | Interested 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 |
|
67 | Need 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 |
|
73 | Want 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 |
|
78 | run=$(stream config:get --json)
|
79 |
|
80 | name=$(jq --raw-output '.name' <<< "${run}")
|
81 | email=$(jq --raw-output '.email' <<< "${run}")
|
82 | apiKey=$(jq --raw-output '.apiKey' <<< "${run}")
|
83 | apiSecret=$(jq --raw-output '.apiSecret' <<< "${run}")
|
84 |
|
85 | echo $name
|
86 | echo $email
|
87 | echo $apiKey
|
88 | echo $apiSecret
|
89 | ```
|
90 |
|
91 | **OR**
|
92 |
|
93 | ```bash
|
94 | #! /bin/bash
|
95 |
|
96 | stream 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 |
|
104 | ```sh-session
|
105 | $ npm install -g getstream-cli
|
106 | $ stream COMMAND
|
107 | running command...
|
108 | $ stream (-v|--version|version)
|
109 | getstream-cli/0.0.34 darwin-x64 node-v12.12.0
|
110 | $ stream --help [COMMAND]
|
111 | USAGE
|
112 | $ stream COMMAND
|
113 | ...
|
114 | ```
|
115 |
|
116 |
|
117 | # 💻 Commands
|
118 |
|
119 |
|
120 | # Command Topics
|
121 |
|
122 | * [`stream autocomplete`](docs/autocomplete.md) - display autocomplete installation instructions
|
123 | * [`stream chat`](docs/chat.md) - configure and manage all things related to chat
|
124 | * [`stream commands`](docs/commands.md) - list all the commands
|
125 | * [`stream config`](docs/config.md) - manage configuration variables
|
126 | * [`stream debug`](docs/debug.md) - debugging tools
|
127 | * [`stream help`](docs/help.md) - display help for stream
|
128 |
|
129 |
|
130 |
|
131 | # 📣 Feedback
|
132 |
|
133 | If 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).
|