Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,15 +335,15 @@ struct ChatsDeleteArgs {

#[derive(Subcommand)]
enum UsersCommand {
#[command(about = "List users that appear in your chats")]
#[command(about = "List users that appear in your chats", alias = "search", alias = "find")]
List(UsersListArgs),
#[command(about = "Fetch a user by id from the chat list payload")]
Get(UserGetArgs),
}

#[derive(Args)]
struct UsersListArgs {
#[arg(long, help = "Filter users by name, username, email, or phone")]
#[arg(help = "Filter users by name, username, email, or phone")]
filter: Option<String>,
}

Expand Down Expand Up @@ -469,6 +469,10 @@ struct MessagesSendArgs {
#[arg(long, help = "Message text (used as caption for attachments)")]
text: Option<String>,

/// Message text as trailing positional args (alternative to --text)
#[arg(trailing_var_arg = true, allow_hyphen_values = true, hide = true)]
text_positional: Vec<String>,

#[arg(long, help = "Reply to message id")]
reply_to: Option<i64>,

Expand Down Expand Up @@ -1527,7 +1531,14 @@ async fn run() -> Result<(), Box<dyn std::error::Error>> {
let token = require_token(&auth_store)?;
let peer = input_peer_from_args(args.chat_id, args.user_id)?;
let reply_to = args.reply_to;
let caption = resolve_message_caption(args.text, args.stdin)?;
let text = args.text.or_else(|| {
if args.text_positional.is_empty() {
None
} else {
Some(args.text_positional.join(" "))
}
});
let caption = resolve_message_caption(text, args.stdin)?;
let attachments = prepare_attachments(
&args.attachments,
&config.data_dir,
Expand Down