Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending unclear #1649

Open
pepa65 opened this issue Dec 9, 2024 · 7 comments
Open

Sending unclear #1649

pepa65 opened this issue Dec 9, 2024 · 7 comments

Comments

@pepa65
Copy link

pepa65 commented Dec 9, 2024

If I do signal-cli send -h it gives a usage message where -u must be followed by USERNAME and -a by ATTACHMENT. But if I try signal-cli send -u USERNAME -m MESSAGE RECIPIENT it comes back with Multiple users found, you need to specify an account (phone number) with -a. But if I do that, it still comes back with the same message.

It seems the help-message, or the error-message is broken, and in any case, I can't seem to figure out how to send a message...

EDIT: using signal-cli -a PHONENR send -u USERNAME.NUM -m MESSAGE works!! It seems the help and error messages need a complete overhaul...

@cuu508
Copy link
Contributor

cuu508 commented Dec 19, 2024

Hey @pepa65,

you said:

[...] it comes back with Multiple users found, you need to specify an account (phone number) with -a. But if I do that, it still comes back with the same message.

but later got it working. What command were you using the first time, when you added -a but it still didn't work?

@pepa65
Copy link
Author

pepa65 commented Dec 20, 2024

I guess signal-cli send -a USERNAME -u USERNAME -m MESSAGE RECIPIENT

@cuu508
Copy link
Contributor

cuu508 commented Dec 20, 2024

Ah, OK, so I'm guessing the unclear bit in the Multiple users found, you need to specify an account (phone number) with -a message was whether "multiple users" refers to the sender or the recipient, right?

Let's say the message was:

Multiple user accounts found in the config directory, please specify an account (by its phone number) with -a

Do you think this would have helped?

@pepa65
Copy link
Author

pepa65 commented Dec 20, 2024

My problem was not so much with the clarity of the message. although what you propose is clearer. I started with this: signal-cli send -h:

usage: signal-cli [-h] [-v] [--log-file LOG_FILE] [--scrub-log]

named arguments:
  -h, --help             show this help message and exit
  -v, --verbose
  --log-file LOG_FILE
  --scrub-log
usage: signal-cli send [-h] [-g [GROUP_ID [GROUP_ID ...]]] [-u [USERNAME [USERNAME ...]]] [--note-to-self] [--notify-self]
                  [-a [ATTACHMENT [ATTACHMENT ...]]] [-e] [--mention [MENTION [MENTION ...]]]
                  [--text-style [TEXT_STYLE [TEXT_STYLE ...]]] [--quote-timestamp QUOTE_TIMESTAMP]
                  [--quote-author QUOTE_AUTHOR] [--quote-message QUOTE_MESSAGE]
                  [--quote-mention [QUOTE_MENTION [QUOTE_MENTION ...]]]
                  [--quote-attachment [QUOTE_ATTACHMENT [QUOTE_ATTACHMENT ...]]]
                  [--quote-text-style [QUOTE_TEXT_STYLE [QUOTE_TEXT_STYLE ...]]] [--sticker STICKER]
                  [--preview-url PREVIEW_URL] [--preview-title PREVIEW_TITLE] [--preview-description PREVIEW_DESCRIPTION]
                  [--preview-image PREVIEW_IMAGE] [--story-timestamp STORY_TIMESTAMP] [--story-author STORY_AUTHOR]
                  [--edit-timestamp EDIT_TIMESTAMP] [-m MESSAGE | --message-from-stdin] [recipient [recipient ...]]

positional arguments:
  recipient              Specify the recipients' phone number.

named arguments:
  -h, --help             show this help message and exit
  -g [GROUP_ID [GROUP_ID ...]], --group-id [GROUP_ID [GROUP_ID ...]], --group [GROUP_ID [GROUP_ID ...]]
                         Specify the recipient group ID.
  -u [USERNAME [USERNAME ...]], --username [USERNAME [USERNAME ...]]
                         Specify the recipient username or username link.
  --note-to-self         Send the message to self without notification.
  --notify-self          If self is part of recipients/groups send a normal message, not a sync message.
  -m MESSAGE, --message MESSAGE
                         Specify the message to be sent.
  --message-from-stdin   Read the message from standard input.
  -a [ATTACHMENT [ATTACHMENT ...]], --attachment [ATTACHMENT [ATTACHMENT ...]]
                         Add an attachment. Can be either a file  path  or  a  data URI. Data URI encoded attachments must
                         follow  the  RFC  2397.  Additionally  a   file   name   can  be  added,  e.g.  data:<MIME-TYPE>;
                         filename=<FILENAME>;base64,<BASE64 ENCODED DATA>.
  -e, --end-session, --endsession
                         Clear session state and send end session message.
  --mention [MENTION [MENTION ...]]
                         Mention another group member (syntax: start:length:recipientNumber).  Unit of start and length is
                         UTF-16 code units, NOT Unicode code points.
  --text-style [TEXT_STYLE [TEXT_STYLE ...]]
                         Style parts of the message text (syntax: start:length:STYLE).  Unit of start and length is UTF-16
                         code units, NOT Unicode code points.
  --quote-timestamp QUOTE_TIMESTAMP
                         Specify the timestamp of a previous message with  the  recipient  or  group to add a quote to the
                         new message.
  --quote-author QUOTE_AUTHOR
                         Specify the number of the author of the original message.
  --quote-message QUOTE_MESSAGE
                         Specify the message of the original message.
  --quote-mention [QUOTE_MENTION [QUOTE_MENTION ...]]
                         Quote with mention of another group member (syntax: start:length:recipientNumber)
  --quote-attachment [QUOTE_ATTACHMENT [QUOTE_ATTACHMENT ...]]
                         Specify the attachments of  the  original message (syntax: contentType[:filename[:previewFile]]),
                         e.g. 'audio/aac' or 'image/png:test.png:/tmp/preview.jpg'.
  --quote-text-style [QUOTE_TEXT_STYLE [QUOTE_TEXT_STYLE ...]]
                         Quote with style parts of the message text (syntax: start:length:STYLE)
  --sticker STICKER      Send a sticker (syntax: stickerPackId:stickerId)
  --preview-url PREVIEW_URL
                         Specify the url for the link preview (the same url must also appear in the message body).
  --preview-title PREVIEW_TITLE
                         Specify the title for the link preview (mandatory).
  --preview-description PREVIEW_DESCRIPTION
                         Specify the description for the link preview (optional).
  --preview-image PREVIEW_IMAGE
                         Specify the image file for the link preview (optional).
  --story-timestamp STORY_TIMESTAMP
                         Specify the timestamp of a story to reply to.
  --story-author STORY_AUTHOR
                         Specify the number of the author of the story.
  --edit-timestamp EDIT_TIMESTAMP
                         Specify the timestamp of a  previous  message  with  the  recipient  or  group  to send an edited
                         message.

This seems to suggest that nothing goes before the send argument, while in fact, you need to specify the sending account with -a PHONENR. before send. I am guessing any -a after send is used to specify attachments.

I think it needs to be clarified that some flags need to come before the subcomand, and they are completely separate from any flags after the subcommand.

@pepa65
Copy link
Author

pepa65 commented Dec 20, 2024

For posterity, if there are multiple accounts registered on your signal-cli instance and you want to use a specific one, start your commands with: signal-cli -a ACCOUNTPHONENR. So sending a message could be as simple as: signal-cli -a ACCOUNTPHONENR send -m MESSAGE DESTPHONENR or, if you don't know the recipient's phone number: signal-cli -a ACCOUNTPHONENR send -m MESSAGE u:USERNAME.NUM

@cuu508
Copy link
Contributor

cuu508 commented Dec 20, 2024

BTW there's a number of arguments, not just -a, that can come before the command. You can see them with signal-cli -h.

I'm not sure including them in the -h output for every command would work well. The already long output would get longer. There would be two separate sections documenting -a (one for --account and the other for --attachment).

One idea, perhaps the error message should use the long name for the argument?

Multiple user accounts found in the config directory, please specify an account (by its phone number) with --account

In general, though, signal-cli is a tool where lots of functionality has to be packed behind arguments and parameters. In this aspect it is a little similar to, say, curl. Like with curl, you can't read the help output and expect to master it. It is a complex thing that takes some figuring out :-)

@pepa65
Copy link
Author

pepa65 commented Dec 20, 2024

Yes, once I realized there were command-wide flags that go before the subcommand and subcommand-specific flags that come after, it all started to make sense. You could consider an after-help message (on line 7 of client/src/cli.rs) like: "The general command-wide arguments are shown with 'signal-cli -h' and need to come before the subcommand, while the subcommand-specific arguments (show with 'signal-cli SUBCOMMAND -h') need to be given after the subcommand."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants