Skip to content
Snippets Groups Projects
Commit 647cbea9 authored by Eric S. Raymond's avatar Eric S. Raymond
Browse files

With -i, message string argument now optional, stdin is read if it is absent.

parent 0c292a45
No related branches found
No related tags found
No related merge requests found
irker history irker history
Repository head:
With -i, message string argument now optional, stdin is read if it is absent.
2.10: 2014-06-19 2.10: 2014-06-19
irk no longer fails on ircs channel URLs. irk no longer fails on ircs channel URLs.
......
...@@ -1001,10 +1001,12 @@ if __name__ == '__main__': ...@@ -1001,10 +1001,12 @@ if __name__ == '__main__':
LOG.info("irkerd version %s" % version) LOG.info("irkerd version %s" % version)
if args.immediate: if args.immediate:
if not args.message: if not args.message:
LOG.error( # We want newline to become '\n' and tab to become '\t';
'--immediate set (%r), but message argument not given' % ( # the JSON decoder will undo these transformations.
args.immediate)) # This will also encode backslash, backspace, formfeed,
raise SystemExit(1) # and high-half characters, which might produce unexpected
# results on output.
args.message = sys.stdin.read().encode("string_escape")
irker.irc.add_event_handler("quit", lambda _c, _e: sys.exit(0)) irker.irc.add_event_handler("quit", lambda _c, _e: sys.exit(0))
irker.handle('{"to":"%s","privmsg":"%s"}' % ( irker.handle('{"to":"%s","privmsg":"%s"}' % (
args.immediate, args.message), quit_after=True) args.immediate, args.message), quit_after=True)
......
...@@ -185,9 +185,11 @@ authenticate the nick on receipt of a welcome message.</para></listitem> ...@@ -185,9 +185,11 @@ authenticate the nick on receipt of a welcome message.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>-i</term> <term>-i</term>
<listitem><para>Immediate mode, to be run in foreground. Takes two <listitem><para>Immediate mode, to be run in foreground. Takes a following
following values interpreted as a channel URL and a message following value interpreted as a channel URL. May take a second
string. Sends the message, then quits.</para></listitem> argument giving a message string; if the sedond argument is absent the
message is read from standard input (and may contain newlines).
Sends the message, then quits.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>-V</term> <term>-V</term>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment