Add `--version` flag.

v0.2
Martin Dosch 2 years ago
parent 5b72f3cee0
commit 5b86e1b48f

@ -5,6 +5,7 @@
- Added listening function.
- Added flag to configure connection timeout.
- Added flag to configure minimum TLS version.
- Added flag to show version.
### Removed
- Removed deprecated option `-x`.

@ -75,7 +75,7 @@ If no configuration file is present or if the values should be overridden it is
the account details via command line options:
```plain
Usage: go-sendxmpp [-cdilnt] [-f value] [--help] [--http-upload value] [-j value] [-m value] [-p value] [--raw] [-r value] [--timeout value] [--tls-version value] [-u value] [parameters ...]
Usage: go-sendxmpp [-cdilnt] [-f value] [--help] [--http-upload value] [-j value] [-m value] [-p value] [--raw] [-r value] [--timeout value] [--tls-version value] [-u value] [--version] [parameters ...]
-c, --chatroom Send message to a chatroom.
-d, --debug Show debugging info.
-f, --file=value Set configuration file. (Default:
@ -105,6 +105,7 @@ Usage: go-sendxmpp [-cdilnt] [-f value] [--help] [--http-upload value] [-j value
(TLSv1.2) or 13 (TLSv1.3). [12]
-u, --username=value
Username for XMPP account.
--version Show version information.
```
### examples

@ -240,6 +240,7 @@ func main() {
flagTimeout := getopt.IntLong("timeout", 0, 10, "Connection timeout in seconds.")
flagTLSMinVersion := getopt.IntLong("tls-version", 0, 12,
"Minimal TLS version. 10 (TSLv1.0), 11 (TLSv1.1), 12 (TLSv1.2) or 13 (TLSv1.3).")
flagVersion := getopt.BoolLong("version", 0, "Show version information.")
// Parse command line flags.
getopt.Parse()
@ -250,6 +251,13 @@ func main() {
os.Exit(0)
}
// If requested, show version and quit.
if *flagVersion {
fmt.Println("go-sendxmpp", "devel")
fmt.Println("License: BSD-2-clause")
os.Exit(0)
}
// Read recipients from command line and quit if none are specified.
// For listening or sending raw XML it's not required to specify a recipient except
// when sending raw messages to MUCs (go-sendxmpp will join the MUC automatically).

@ -10,57 +10,43 @@ A little tool to send messages to an XMPP contact or MUC inspired by (but not as
.br
You can either pipe a programs output to \fBgo\-sendxmpp\fR, write in your terminal (put \fB^D\fR in a new line to finish) or send the input from a file (\fB\-m\fR or \fB\-\-message\fR)\. The account data is expected at \fB~/\.config/go\-sendxmpp/sendxmpprc\fR (preferred) or \fB~/\.sendxmpprc\fR (for compatibility with the original perl sendxmpp) if no other configuration file location is specified with \fB\-f\fR or \fB\-\-file\fR\.
.SH "OPTIONS"
.TP
\fB\-c\fR, \fB\-\-chatroom\fR=[\fIvalue\fR]
Send message to a chatroom\.
.TP
\fB\-d\fR, \fB\-\-debug\fR
Show debugging info\.
.TP
\fB\-f\fR, \fB\-\-file\fR=[\fIvalue\fR]
Set configuration file\. (Default: ~/\.sendxmpprc)
.TP
\fB\-\-help\fR
Show help\.
.TP
\fB\-\-http\-upload=\fR[\fIvalue\fR]
Send a file via http\-upload\.
.TP
\fB\-i\fR, \fB\-\-interactive\fR
Interactive mode (for use with e\.g\. \fBtail \-f\fR)\.
.TP
\fB\-j\fR, \fB\-\-jserver\fR=[\fIvalue\fR]
XMPP server address\.
.TP
\fB\-l\fR, \fB\-\-listen\fR
Listen for messages and print them to stdout\. If JIDs are specified only messages from those contacts are shown\. If no JIDs are specified all received messages will be shown\.
.TP
\fB\-m\fR, \fB\-\-message\fR=[\fIvalue\fR]
Set file including the message\.
.TP
\fB\-n\fR, \fB\-\-no\-tls\-verify\fR
Skip verification of TLS certificates (not recommended)\.
.TP
\fB\-\-tls\-version\fR=[\fIvalue\fR]
Minimal TLS version\. 10 (TSLv1\.0), 11 (TLSv1\.1) (Default: 12)
.TP
\fB\-p\fR, \fB\-\-password\fR=[\fIvalue\fR]
Password for XMPP account\.
.TP
\fB\-\-raw\fR
Send raw XML\. To send raw XML to a contact as normal chat message no contact must be specified\. To send raw XML to a MUC you have to specify the MUC via \fB\-c\fR and \fBgo\-sendxmpp\fR will join the MUC\.
.TP
\fB\-r\fR, \fB\-\-resource\fR=[\fIvalue\fR]
Set resource\. When sending to a chatroom this is used as 'alias'\.
.TP
\fB\-\-timeout=\fR[\fIvalue\fR]
Connection timeout in seconds\. (Default: 10)
.TP
\fB\-t\fR, \fB\-\-tls\fR
Use direct TLS\.
.TP
\fB\-u\fR, \fB\-\-username\fR=[\fIvalue\fR]
Username for XMPP account (JID)\.
.IP "\[ci]" 4
\fB\-c\fR, \fB\-\-chatroom\fR=[\fIvalue\fR]: Send message to a chatroom\.
.IP "\[ci]" 4
\fB\-d\fR, \fB\-\-debug\fR: Show debugging info\.
.IP "\[ci]" 4
\fB\-f\fR, \fB\-\-file\fR=[\fIvalue\fR]: Set configuration file\. (Default: ~/\.sendxmpprc)
.IP "\[ci]" 4
\fB\-\-help\fR: Show help\.
.IP "\[ci]" 4
\fB\-\-http\-upload=\fR[\fIvalue\fR]: Send a file via http\-upload\.
.IP "\[ci]" 4
\fB\-i\fR, \fB\-\-interactive\fR: Interactive mode (for use with e\.g\. \fBtail \-f\fR)\.
.IP "\[ci]" 4
\fB\-j\fR, \fB\-\-jserver\fR=[\fIvalue\fR]: XMPP server address\.
.IP "\[ci]" 4
\fB\-l\fR, \fB\-\-listen\fR: Listen for messages and print them to stdout\. If JIDs are specified only messages from those contacts are shown\. If no JIDs are specified all received messages will be shown\.
.IP "\[ci]" 4
\fB\-m\fR, \fB\-\-message\fR=[\fIvalue\fR]: Set file including the message\.
.IP "\[ci]" 4
\fB\-n\fR, \fB\-\-no\-tls\-verify\fR: Skip verification of TLS certificates (not recommended)\.
.IP "\[ci]" 4
\fB\-\-tls\-version\fR=[\fIvalue\fR]: Minimal TLS version\. 10 (TSLv1\.0), 11 (TLSv1\.1) (Default: 12)
.IP "\[ci]" 4
\fB\-p\fR, \fB\-\-password\fR=[\fIvalue\fR]: Password for XMPP account\.
.IP "\[ci]" 4
\fB\-\-raw\fR: Send raw XML\. To send raw XML to a contact as normal chat message no contact must be specified\. To send raw XML to a MUC you have to specify the MUC via \fB\-c\fR and \fBgo\-sendxmpp\fR will join the MUC\.
.IP "\[ci]" 4
\fB\-r\fR, \fB\-\-resource\fR=[\fIvalue\fR]: Set resource\. When sending to a chatroom this is used as 'alias'\.
.IP "\[ci]" 4
\fB\-\-timeout=\fR[\fIvalue\fR]: Connection timeout in seconds\. (Default: 10)
.IP "\[ci]" 4
\fB\-t\fR, \fB\-\-tls\fR: Use direct TLS\.
.IP "\[ci]" 4
\fB\-u\fR, \fB\-\-username\fR=[\fIvalue\fR]: Username for XMPP account (JID)\.
.IP "\[ci]" 4
\fB\-\-version\fR: Show version information\.
.IP "" 0
.SH "CHAT"
Feel free to join \fIhttps://join\.jabber\.network/#go\-sendxmpp@chat\.mdosch\.de?join\fR\.
.SH "AUTHOR"

@ -91,65 +91,82 @@ compatibility with the original perl sendxmpp) if no other configuration file lo
<h2 id="OPTIONS">OPTIONS</h2>
<dl>
<dt>
<code>-c</code>, <code>--chatroom</code>=[<var>value</var>]</dt>
<dd>Send message to a chatroom.</dd>
<dt>
<code>-d</code>, <code>--debug</code>
</dt>
<dd>Show debugging info.</dd>
<dt>
<code>-f</code>, <code>--file</code>=[<var>value</var>]</dt>
<dd>Set configuration file. (Default: ~/.sendxmpprc)</dd>
<dt><code>--help</code></dt>
<dd>Show help.</dd>
<dt>
<code>--http-upload=</code>[<var>value</var>]</dt>
<dd>Send a file via http-upload.</dd>
<dt>
<code>-i</code>, <code>--interactive</code>
</dt>
<dd>Interactive mode (for use with e.g. <code>tail -f</code>).</dd>
<dt>
<code>-j</code>, <code>--jserver</code>=[<var>value</var>]</dt>
<dd>XMPP server address.</dd>
<dt>
<code>-l</code>, <code>--listen</code>
</dt>
<dd>Listen for messages and print them to stdout. If JIDs are specified only messages from those contacts
are shown. If no JIDs are specified all received messages will be shown.</dd>
<dt>
<code>-m</code>, <code>--message</code>=[<var>value</var>]</dt>
<dd>Set file including the message.</dd>
<dt>
<code>-n</code>, <code>--no-tls-verify</code>
</dt>
<dd>Skip verification of TLS certificates (not recommended).</dd>
<dt>
<code>--tls-version</code>=[<var>value</var>]</dt>
<dd>Minimal TLS version. 10 (TSLv1.0), 11 (TLSv1.1) (Default: 12)</dd>
<dt>
<code>-p</code>, <code>--password</code>=[<var>value</var>]</dt>
<dd>Password for XMPP account.</dd>
<dt><code>--raw</code></dt>
<dd>Send raw XML. To send raw XML to a contact as normal chat message no contact must be specified.
To send raw XML to a MUC you have to specify the MUC via <code>-c</code> and <code>go-sendxmpp</code> will join the MUC.</dd>
<dt>
<code>-r</code>, <code>--resource</code>=[<var>value</var>]</dt>
<dd>Set resource. When sending to a chatroom this is used as
'alias'.</dd>
<dt>
<code>--timeout=</code>[<var>value</var>]</dt>
<dd>Connection timeout in seconds. (Default: 10)</dd>
<dt>
<code>-t</code>, <code>--tls</code>
</dt>
<dd>Use direct TLS.</dd>
<dt>
<code>-u</code>, <code>--username</code>=[<var>value</var>]</dt>
<dd>Username for XMPP account (JID).</dd>
</dl>
<ul>
<li>
<p><code>-c</code>, <code>--chatroom</code>=[<var>value</var>]:
Send message to a chatroom.</p>
</li>
<li>
<p><code>-d</code>, <code>--debug</code>:
Show debugging info.</p>
</li>
<li>
<p><code>-f</code>, <code>--file</code>=[<var>value</var>]:
Set configuration file. (Default: ~/.sendxmpprc)</p>
</li>
<li>
<p><code>--help</code>:
Show help.</p>
</li>
<li>
<p><code>--http-upload=</code>[<var>value</var>]:
Send a file via http-upload.</p>
</li>
<li>
<p><code>-i</code>, <code>--interactive</code>:
Interactive mode (for use with e.g. <code>tail -f</code>).</p>
</li>
<li>
<p><code>-j</code>, <code>--jserver</code>=[<var>value</var>]:
XMPP server address.</p>
</li>
<li>
<p><code>-l</code>, <code>--listen</code>:
Listen for messages and print them to stdout. If JIDs are specified only messages from those contacts
are shown. If no JIDs are specified all received messages will be shown.</p>
</li>
<li>
<p><code>-m</code>, <code>--message</code>=[<var>value</var>]:
Set file including the message.</p>
</li>
<li>
<p><code>-n</code>, <code>--no-tls-verify</code>:
Skip verification of TLS certificates (not recommended).</p>
</li>
<li>
<p><code>--tls-version</code>=[<var>value</var>]:
Minimal TLS version. 10 (TSLv1.0), 11 (TLSv1.1) (Default: 12)</p>
</li>
<li>
<p><code>-p</code>, <code>--password</code>=[<var>value</var>]:
Password for XMPP account.</p>
</li>
<li>
<p><code>--raw</code>:
Send raw XML. To send raw XML to a contact as normal chat message no contact must be specified.
To send raw XML to a MUC you have to specify the MUC via <code>-c</code> and <code>go-sendxmpp</code> will join the MUC.</p>
</li>
<li>
<p><code>-r</code>, <code>--resource</code>=[<var>value</var>]:
Set resource. When sending to a chatroom this is used as
'alias'.</p>
</li>
<li>
<p><code>--timeout=</code>[<var>value</var>]:
Connection timeout in seconds. (Default: 10)</p>
</li>
<li>
<p><code>-t</code>, <code>--tls</code>:
Use direct TLS.</p>
</li>
<li>
<p><code>-u</code>, <code>--username</code>=[<var>value</var>]:
Username for XMPP account (JID).</p>
</li>
<li>
<p><code>--version</code>: Show version information.</p>
</li>
</ul>
<h2 id="CHAT">CHAT</h2>

@ -70,6 +70,8 @@ Use direct TLS.
* `-u`, `--username`=[<value>]:
Username for XMPP account (JID).
* `--version`: Show version information.
## CHAT
Feel free to join [https://join.jabber.network/#go-sendxmpp@chat.mdosch.de?join](https://join.jabber.network/#go-sendxmpp@chat.mdosch.de?join).

Loading…
Cancel
Save