Add readme

This commit is contained in:
Jannis Mattheis
2018-11-25 11:52:15 +01:00
parent ec4a598f12
commit 598cbbc232
2 changed files with 144 additions and 0 deletions

144
README.md Normal file
View File

@@ -0,0 +1,144 @@
# Gotify-CLI [![travus-badge][travis-badge]][travis] [![badge-release][badge-release]][release]
Gotify-CLI is a command line client for pushing messages to [gotify/server][gotify/server]. It is **not** required to push messages. See [alternatives](#alternatives).
<p align="center">
<img src="gotify_cli.gif"/>
</p>
## Features
* stores token/url in a config file
* initialization wizard
* piping support (`echo message | gotify push`)
* simple to use
## Alternatives
You can simply use [curl](https://curl.haxx.se/), [HTTPie](https://httpie.org/) or any other http-client to push messages.
```bash
$ curl -X POST "https://push.example.de/message?token=<apptoken>" -F "title=my title" -F "message=my message"
$ http -f POST "https://push.example.de/message?token=<apptoken>" title="my title" message="my message"
```
## Installation
Download the [latest release][release] for your os: (this example uses version `v1.2.0`)
```bash
$ wget -o gotify https://github.com/gotify/cli/releases/download/v1.2.0/gotify-cli-linux-amd64
# or
$ curl -Lo gotify https://github.com/gotify/cli/releases/download/v1.2.0/gotify-cli-linux-amd64
```
Make `gotify` executable:
```bash
$ chmod +x gotify
```
Test if the Gotify-CLI works: *(When it doesn't work, you may have downloaded the wrong file or your device/os isn't supported)*
```bash
$ gotify version
```
It should output something like this:
```bash
Version: 1.2.0
Commit: ec4a598f124c149802038c74571aa704a6660c4a
BuildDate: 2018-11-24-19:41:36
```
*(optional)* Move the executable to a folder on your `$PATH`:
```bash
$ mv gotify /usr/bin/gotify
```
Now you can either run the initialization wizard or [create a config manually](#Configuration). This tutorial uses the wizard.
```bash
$ gotify init
```
When you've finished initializing Gotify-CLI, you are ready to push messages to [gotify/server][gotify/server].
Here are some examples commands, you can view the "push help" via `gotify help push` (or have a look at [push help](#push-help)).
```json
$ gotify push my message
$ gotify push "my message"
$ echo my message | gotify push
$ gotify push < somefile
$ gotify push -t "my title" -p 10 "my message"
```
## Help
**Uses version `v1.2.0`**
```bash
$ gotify help
NAME:
Gotify - The official Gotify-CLI
USAGE:
gotify [global options] command [command options] [arguments...]
VERSION:
1.2.0
COMMANDS:
init Initializes the Gotify-CLI
version, v Shows the version
config Shows the config
push, p Pushes a message
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
```
### Push help
```bash
$ gotify help push
NAME:
gotify push - Pushes a message
USAGE:
gotify push [command options] <message-text>
DESCRIPTION:
the message can also provided in stdin f.ex:
echo my text | gotify push
OPTIONS:
--priority value, -p value Set the priority (default: 0)
--title value, -t value Set the title (empty for app name)
--token value Override the app token
--url value Override the Gotify URL
--quiet, -q Do not output anything (on success)
```
## Configuration
**Note: The config can be created by `gotify init`.**
Gotify-CLI will search the following paths for a config file:
* `/etc/gotify/cli.json`
* `~/.gotify/cli.json`
* `./cli.json`
### Structure
| name | description | example |
| ----- | ----------- | ------- |
| token | an application token (a client token will not work) | `A4ZudDRdLT40L5X` |
| url | the URL to your [gotify/server][gotify/server] | `https://gotify.example.com` |
### Config example
```json
{
"token": "A4ZudDRdLT40L5X",
"url": "https://gotify.example.com"
}
```
[gotify/server]: https://github.com/gotify/server
[travis-badge]: https://travis-ci.org/gotify/cli.svg?branch=master
[travis]: https://travis-ci.org/gotify/cli
[badge-release]: https://img.shields.io/github/release/gotify/cli.svg
[release]: https://github.com/gotify/cli/releases/latest

BIN
gotify_cli.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 KiB