mirror of
https://github.com/aljazceru/signal-cli.git
synced 2025-12-29 12:04:20 +01:00
Remove fallback to reading stdin if no message body is given
To read a message from stdin, use the `--message-from-stdin` flag
This commit is contained in:
@@ -120,13 +120,15 @@ public class SendCommand implements JsonRpcLocalCommand {
|
||||
|
||||
var messageText = ns.getString("message");
|
||||
final var readMessageFromStdin = ns.getBoolean("message-from-stdin") == Boolean.TRUE;
|
||||
if (readMessageFromStdin || (messageText == null && sticker == null)) {
|
||||
if (readMessageFromStdin) {
|
||||
logger.debug("Reading message from stdin...");
|
||||
try {
|
||||
messageText = IOUtils.readAll(System.in, IOUtils.getConsoleCharset());
|
||||
} catch (IOException e) {
|
||||
throw new UserErrorException("Failed to read message from stdin: " + e.getMessage());
|
||||
}
|
||||
} else if (messageText == null) {
|
||||
messageText = "";
|
||||
}
|
||||
|
||||
List<String> attachments = ns.getList("attachment");
|
||||
@@ -169,7 +171,7 @@ public class SendCommand implements JsonRpcLocalCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
var results = m.sendMessage(new Message(messageText == null ? "" : messageText,
|
||||
var results = m.sendMessage(new Message(messageText,
|
||||
attachments,
|
||||
mentions,
|
||||
Optional.ofNullable(quote),
|
||||
|
||||
Reference in New Issue
Block a user