Coder Social home page Coder Social logo

cli's People

Contributors

15cm avatar avnercohen avatar chenrui333 avatar dreamsvoid avatar jmattheis avatar rorpage avatar scottwallacesh avatar stewartthomson avatar tessus avatar tohn avatar z-nexx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cli's Issues

gotify init skip TLS validation

Currently, it's impossible to use gotify with a server running a self-signed cert.

gotify-cli init
(enter url)
Connecting -> Failed
Error: Get https://myserver.com/version: x509 certificate signed by unknown authority

gotify-cli init needs a flag to allow untrusted certificates.

Request for new release

Dear gotify devs,

I appreciate a lot this CLI for gotify and already integrated it for multiple purposes on two servers. I'd love to use the configuration option for the default notification priority, which is not yet available (or fixed) in the current release.
Can you please publish a new release with binaries of the current master so people can receive this feature through the package managers of their OS?
For reference, the need for a new release was mentioned in #36.

Thank you!

Support watching command output

I think it would be good if we can support watching changes of command output and sending the difference to gotify, similar to the watch command in *nix.

Then, when we want to do something really simple such as watching a change to the return of an api, we can simply do:

$ gotify-cli watch 'curl http://api.example.com/some_data | jq ".something_interesting"'

And them gotify would keep polling the data and send a notification when the output changes.

[Polite question] What are the advantages of "watch" command?

Hello.

I watched the development of the watch command and didn't understand what it was about. Now I tried it and still don't understand what the command is for.

In a normal 3 line bash loop I can make a comparison, evaluate the result and output it formatted as a message. Great.

With the Watch command I can only see the difference. What is this? What are the advantages?

This is a very polite question because I really don't understand it. :-)

Invalid

Please delete this. This was not a bug.

Add `GOTIFY_SKIP_VERIFY_TLS` option to the config file

Would it be possible to add the GOTIFY_SKIP_VERIFY_TLS flag to the configuration file?

{
  "token": "A4ZudDRdLT40L5X",
  "url": "https://gotify.example.com",
  "defaultPriority": 6
  "skipVerifyTls": true
}

This way the whole configuration would reside in one place.

Redirect sent message to file

Hello,

Is is possible to have the message that's sent to Gotify also saved to a text file?

.\gotify-cli-windows-amd64.exe push "hello" > checkme.txt
> type .\checkme.txt
message created

I would like to have "hello" saved in the text file.

CLI report wrong version number

The latest release "2.2.1" show the correct date but the wrong version and commit hash, I found this accidentally trying to create a script to check if a greater version is available.

$ gotify-cli -v
Version:   2.1.1
Commit:    bafdc655d319c3e3a8716efd8da5a15db4bbf096
BuildDate: 2021-12-11-19:22:36

Expected:

$ gotify-cli -v
Version:   2.2.1
Commit:    5714fb3d004271eb18a76456163208d1010e720d
BuildDate: 2021-12-11-19:22:36

Thanks for great work!

[Documentation cli 2.0.0] Example to send a message with cli (Plain Text and Markdown)

Hello.
I have my problems to understand the doku. ;-)
I will give some examples to send a message from bash.

As Mardown: Value of CR are two spaces and carriage return!
printf -v CR " \n" # Fill variable $CR
./gotify-cli-linux-amd64 p -p 0 --url "https://mydomain.com/gotify" --token "Axxxxxxxxxxxxxx" --contentType "text/markdown" -t "Title" "FirstLine${CR}**SecondLine**${CR}\*\*ThirdLine\*\*"
Result:

FirstLine
SecondLine
**ThirdLine**

As Plain Text: Value of CR is only carriage return.
printf -v CR "\n" # Fill variable $CR
./gotify-cli-linux-amd64 p -p 0 --url "https://mydomain.com/gotify" --token "Axxxxxxxxxxxxxx" --contentType "text/plain" -t "Title" "FirstLine${CR}**SecondLine**"
Result:

FirstLine
**SecondLine**

watch without command timeout

sometime it is nice to run a command which is importend to complete, but the next run should not be to wide in the future.

it would be nice, that this command does not cancle on timeout, and the next run should be the interval time after the command complete time.

could we got a flag/option for it? (like --no-timeout)
I like that there is also a timeout option ...

How to insert newlines into text?

Hi, is it possible to insert newline characters into the text that is sent?

I've tried inserting \n in the text - result is it just gets output, eg. gotify push -t "Test" -p 5 "fred\nnurk" gives: fred\nnurk

Also tried setting a variable as newline, eg. nl=$'\n', but this gets transformed into a space, eg. gotify push -t "Test" -p 5 "fred${nl}nurk" gives: fred nurk

TIA

bash implementation

I don't know why this script/program is written in GO, so I created a bash-version of this program.

https://github.com/RubenNL/gotify-bash

Would it be possible to have an official version based on bash? Not everyone is able to use the binaries/compile GO on his platform.

Why not use this CLI for E2EE

End to end encryption might be rather difficult without some kind of sending client this tool might be ideal. Also, this is a really helpful thing because you can just pipe things to it. Sure you can do that with curl but its way easier with a single binary.

How to use it with multiple applications and users?

Hi

The init seems to recreate the json file. I am wondering if it is possibe to use the cli app with multiple tokens and users easily without entering all those long details ? It works well when there is only one app token.

thanks

unknown error (status 500): {resp:0x40007b6000}

Hello,
i get this error unknown error (status 500): {resp:0x40007b6000} when i run any of the following commands:

echo "โœ“" | gotify push
echo 'โœ“' | gotify push
echo โœ“ | gotify push

What is the right syntax to push a message which includes the symbol above?

Is there a way to run command/scripts according to the received messges?

I am curious about if there's a similar program like cli which can watching/waiting the messages, and run commands according to the received messages?

If such a tool exists, can anyone tell me, thanks?
I am hoping to use such a tool to control my raspberryPi Linux to do something according to messages.

./cli.json on windows executable resolves to current working directory instead of path relative to .exe.

After running init and selecting to save the configs to ./cli.json the executable is unable to find the config file unless the console working directory is the executable's directory. In fact, I believe the ./cli.json file is saved to whichever working directory you have active when initis run.

Not sure if this is the intended functionality but I expected it to save to the same directory as the .exe file and to always be loaded from there regardless of my working directory.

As a temporary fix I created a batch script that I am using to call the cli app from anywhere with the expected behavior. I'm posting it here in case anyone finds this thread and needs an immediate fix.

gotify.bat
-----------------
@echo off
pushd %~dp0
Call %~dp0\gotify-cli-windows-amd64.exe p -q %* 
popd

The scripts needs to be placed on the same directory as the executable to work as is.

Default priority

Could you add an option to set the default message priority in the cli.json file?

token via env var

If one uses the --token argument, the token shows up in the process list. When I use different scripts on the same machine that use the gotify client, I'd also like to use different tokens in these scripts.

Thus it would be awesome to set a GOTIFY_TOKEN env var in the script and the gotify cli uses the token from the env var.

Any chance that this can be added?

P.S.: I am more than happy to create a PR. I only want to know, whether such a change would be accepted.

Gotify CLI on Termux

I am trying to Run Gotify CLI on Termux Terminal Emulator for Android but Endup with this Below Error while init the CLI

Error: Get https://push.example.com/version: dial tcp: lookup google.com on [::1]:53: read udp [::1]:48773->[::1]:53: read: connection refused

Example of sending image via CLI

Hello, is it possible to send images via gotify cli?

Assuming config file exists.

gotify push --contentType "text/markdown" -t "Image" "https://placekitten.com/400/300"
Thanks?

Default priority set in cli.json is ignored

/etc/gotify/cli.json

{
  "token": "XXXXXXXXXXXXXXX",
  "url": "http://127.0.0.1:8057",
  "defaultPriority": 10
}

When I call gotify-cli push -t "title" "message", the notification successfully gets pushed and received, but the priority is 0.
I restarted the server (systemctl restart gotify-server) to hopefully make it re-read the config file, but it makes no difference. /etc/gotify/cli.json is the only config file I have.

gotify/server v2.0.18 (archlinux)
gotify/cli v2.1.1 (archlinux)

Got golang panic when pushing message with --token parameter

I'd like to use gotify-cli in some automatic scripts invoked by some other services. When I tried to make a parameter settings like these and without the cli.json:
gotify-cli push --url http://gotify.xxxxxxxx.com --token someToken messages
I got a golang panic both on Linux and Windows:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x20 pc=0xd8ea02]

goroutine 1 [running]:
github.com/gotify/cli/v2/command.doPush(0xc00079e2c0)
        /home/jm/src/gotify/cli/command/push.go:72 +0x342
gopkg.in/urfave/cli%2ev1.HandleAction({0xdc0020, 0xe66ce0}, 0x4)
        /home/jm/go/pkg/mod/gopkg.in/urfave/[email protected]/app.go:492 +0x7b
gopkg.in/urfave/cli%2ev1.Command.Run({{0xe3fecd, 0x4}, {0x0, 0x0}, {0xc0003f06e0, 0x1, 0x1}, {0xe4573b, 0x10}, {0x0, ...}, ...}, ...)
        /home/jm/go/pkg/mod/gopkg.in/urfave/[email protected]/command.go:210 +0x8f8
gopkg.in/urfave/cli%2ev1.(*App).Run(0xc00040f1e0, {0xc0000d8000, 0x7, 0x8})
        /home/jm/go/pkg/mod/gopkg.in/urfave/[email protected]/app.go:255 +0x6ac
main.main()
        /home/jm/src/gotify/cli/cli.go:34 +0xf88

But if I run gotify-cli init or create a cli.json file with same url and token, it works well.

send with CLI at only one client/user + CLI and letsencrypt-certificate

Hello,
in my test-environment I have 2 clients (smartphones) who logged in with different usernames.
Now I want to send a message over the CLI only to "user1", but I dont know what's the syntax.

And: I have a letsencrypt-certificate. With the smartphone-client I can check on that the client ignore somewhat so he had login correctly. Is this possible with the CLI too?

With best regards,
reschresch

Use the user directory as default config file location

The current default(first) location for configuration storage is ./cli.json, which is not so useful in most cases since the user would need to:

  • Call gotify-cli in this specific directory for every invocation
  • Create a cli.json in a random directory, which is not a clearly explanatory file name.

So I think in most cases, the user would use user directory as their config storage, so we should put that in front of ./cli.json by default during initialization.

Distribute as a snap?

Hi,

Would you consider distributing this CLI tool as a snap?
This would make it much simpler to install on a bunch of distros, e.g.

snap install gotify-cli
...
gotify-cli push "Hello World"

I've worked out a minimal snapcraft yaml file (assuming it is included in this repo as snap/snapcraft.yaml):

name: gotify-cli
summary: A command line interface for pushing messages to gotify/server.
description: |
  Gotify-CLI is a command line client for pushing messages to gotify/server.

version: git
grade: stable
base: core20

confinement: strict

apps:
  gotify-cli:
    command: bin/cli
    plugs: [network]

parts:
  gotify-cli:
    plugin: go
    source: .

This was enough for me to build it locally, install it and test the init/config/push functionalities. The version command only spits unknowns tho. Furthermore some of the proposed path for the config file are most likely not exposed by default to the snap.

Create linux i386 version

During my migration to i386 linux server i stuck at this point.
In the moment i use a workaround on a second server.
Thanks.

Cli not useable with cronjob when $USER is missing

The CLI for Linux (amd64 and 386) make an error when running within a cronjob. Running from shell does not make any errors. From my point it is the missing environment problem?

This is not working:

#!/bin/bash
/opt/gotify-cli-linux-amd64 p -p 1 --url "http://localhost:8080" --token "Axxxxxxxxxxxxxx" -t "Cron Demo" "via Cronjob"

This error is occur:

user: Current not implemented on linux/amd64
or
user: Current not implemented on linux/386

You can solve the problem with an USER line:

#!/bin/bash

export USER=dummy

/opt/gotify-cli-linux-amd64 p -p 1 --url "http://localhost:8080" --token "Axxxxxxxxxxxxxx" -t "Cron Demo" "via Cronjob"

It does NOT matter which username you add. "dummy" or "root" or "something" is ok.

PS: A note: In my mind there was also am issue with $HOME variable. But in my tests from today $HOME is not needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.