From 9591bcdaa6600adf1ec54f251ec92c975d54efe8 Mon Sep 17 00:00:00 2001 From: Jeremy Baxter Date: Fri, 29 Jul 2022 08:12:43 +1200 Subject: [PATCH] Added -t option --- doc/matrix-send.1.md | 26 ++++++++++++++++------- doc/matrix-send.conf.5.md | 12 ++++++++--- matrix-send | 44 +++++++++++++++++++++++++-------------- matrix-send.1 | 24 ++++++++++++++------- matrix-send.conf.5 | 12 ++++++++--- 5 files changed, 82 insertions(+), 36 deletions(-) diff --git a/doc/matrix-send.1.md b/doc/matrix-send.1.md index 090f25a..e91dc7a 100644 --- a/doc/matrix-send.1.md +++ b/doc/matrix-send.1.md @@ -7,6 +7,7 @@ MATRIX-SEND(1) - General Commands Manual # SYNOPSIS **matrix-send** +\[**-t** *type*] \[**-c**] \[**-h**] \[**-v**] @@ -16,23 +17,34 @@ MATRIX-SEND(1) - General Commands Manual **matrix-send** is a script to send a message to a Matrix room. -It works by sending a JSON request to your Matrix server. The message -type will always be m.text, but other options may be considered in the -future. +It works by sending a JSON message to your Matrix server. The default message +type is m.text, but you can specify a custom type with +*-t*. The options are as follows: +**-t** *type* + +> Change the event type to +> *type*. +> Currently supported types are +> *m.text* +> and +> *m.notice*. +> Default is +> *m.text*. + **-c** > Clear cached access tokens. **-h** -> Show a help menu, then exit. +> Show the help menu, then exit. **-V** -> Print version and program information, then exit +> Print version and program information, then exit. To begin, start by making a configuration file. This always has the location of *~/.config/matrix-send.conf*. @@ -85,7 +97,7 @@ This will be something like Type the Room ID as the argument after the message you wish to send. You may have to escape the exclamation mark with a backslash. For example: - matrix-send "Hello world!" zyxwvutsrq:example.org + matrix-send "Hello world!" \!zyxwvutsrq:example.org That should send a message saying *Hello world!* @@ -117,4 +129,4 @@ There are currently no plans to add encryption to matrix-send.conf(5) -OpenBSD 7.1 - July 28, 2022 +OpenBSD 7.1 - July 29, 2022 diff --git a/doc/matrix-send.conf.5.md b/doc/matrix-send.conf.5.md index ba3f333..8762563 100644 --- a/doc/matrix-send.conf.5.md +++ b/doc/matrix-send.conf.5.md @@ -21,7 +21,7 @@ The following directives are available: * Username *username* - Your Matrix username. + The username of your Matrix account. * Password *password* @@ -29,7 +29,7 @@ The following directives are available: * AccessToken *token* - Instead of using a username and password to obtain an access token, just use + Instead of using a username and password to obtain an access token, use *token*. * CacheLocation @@ -37,6 +37,12 @@ The following directives are available: Instead of caching access tokens to ~/.cache, cache them to *location*. +* DefaultEvent + *type* + Use + *type* + as the default event type instead of m.text. + The following statements are available: * NoCache @@ -57,4 +63,4 @@ The following statements are available: matrix-send(1) -OpenBSD 7.1 - July 28, 2022 +OpenBSD 7.1 - July 29, 2022 diff --git a/matrix-send b/matrix-send index d758ce2..57b79d5 100755 --- a/matrix-send +++ b/matrix-send @@ -22,14 +22,15 @@ vargrep () { } usage () { - printf "usage: $0 [-c] [-h] [-V] message room\n" + printf "usage: matrix-send [-t type] [-c] [-h] [-V] message room\n" exit 1 } help () { cat <