Skip to content

Commit 4cdbfd4

Browse files
committed
Add short command aliases
1 parent 55456db commit 4cdbfd4

File tree

3 files changed

+41
-33
lines changed

3 files changed

+41
-33
lines changed

docs/iamb.1

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@ version and quit.
5050

5151
.Sh "GENERAL COMMANDS"
5252
.Bl -tag -width Ds
53-
.It Sy ":chats"
53+
.It Sy ":c[hats]"
5454
View a list of joined rooms and direct messages.
5555
.It Sy ":dms"
5656
View a list of direct messages.
5757
.It Sy ":logout [user id]"
5858
Log out of
5959
.Nm .
60-
.It Sy ":rooms"
60+
.It Sy ":ro[oms]"
6161
View a list of joined rooms.
62-
.It Sy ":spaces"
62+
.It Sy ":s[paces]"
6363
View a list of joined spaces.
64-
.It Sy ":unreads"
64+
.It Sy ":u[nreads]"
6565
View a list of unread rooms.
66-
.It Sy ":unreads clear"
66+
.It Sy ":u[nreads] clear"
6767
Mark all rooms as read.
6868
.It Sy ":welcome"
6969
View the startup Welcome window.
@@ -93,28 +93,28 @@ Request a new verification with the specified user.
9393

9494
.Sh "MESSAGE COMMANDS"
9595
.Bl -tag -width Ds
96-
.It Sy ":download [path]"
96+
.It Sy ":d[ownload] [path]"
9797
Download an attachment from the selected message and save it to the optional path.
98-
.It Sy ":open [path]"
98+
.It Sy ":o[pen] [path]"
9999
Download and then open an attachment, or open a link in a message.
100-
.It Sy ":edit"
100+
.It Sy ":e[dit]"
101101
Edit the selected message.
102-
.It Sy ":editor"
102+
.It Sy ":ed[itor]"
103103
Open an external
104104
.Ev $EDITOR
105105
to compose a message.
106-
.It Sy ":react [shortcode]"
106+
.It Sy ":r[ea]c[t] [shortcode]"
107107
React to the selected message with an Emoji.
108-
.It Sy ":unreact [shortcode]"
108+
.It Sy ":unr[eact] [shortcode]"
109109
Remove your reaction from the selected message.
110110
When no arguments are given, remove all of your reactions from the message.
111-
.It Sy ":redact [reason]"
111+
.It Sy ":red[act] [reason]"
112112
Redact the selected message with the optional reason.
113-
.It Sy ":reply"
113+
.It Sy ":rep[ly]"
114114
Reply to the selected message.
115-
.It Sy ":cancel"
115+
.It Sy ":ca[ncel]"
116116
Cancel the currently drafted message including replies.
117-
.It Sy ":upload [path]"
117+
.It Sy ":up[load] [path]"
118118
Upload an attachment and send it to the currently selected room.
119119
.El
120120

@@ -137,7 +137,7 @@ Send an invitation to a user to join the currently focused room.
137137
Join a room or open it if you are already joined.
138138
.It Sy ":leave"
139139
Leave the currently focused room.
140-
.It Sy ":members"
140+
.It Sy ":m[embers]"
141141
View a list of members of the currently focused room.
142142
.It Sy ":room name set [name]"
143143
Set the name of the currently focused room.

src/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2074,7 +2074,7 @@ fn complete_cmdarg(
20742074
match cmd.name.as_str() {
20752075
"cancel" | "dms" | "edit" | "redact" | "reply" => vec![],
20762076
"members" | "rooms" | "spaces" | "welcome" => vec![],
2077-
"download" | "keys" | "open" | "upload" => complete_path(text, cursor),
2077+
"download" | "d" | "keys" | "open" | "o" | "upload" | "up" => complete_path(text, cursor),
20782078
"react" | "unreact" => complete_emoji(text, cursor, store),
20792079

20802080
"invite" => complete_users(text, cursor, store),

src/commands.rs

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ fn iamb_logout(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
698698
fn add_iamb_commands(cmds: &mut ProgramCommands) {
699699
cmds.add_command(ProgramCommand {
700700
name: "cancel".into(),
701-
aliases: vec![],
701+
aliases: vec!["ca".into()],
702702
f: iamb_cancel,
703703
});
704704
cmds.add_command(ProgramCommand {
@@ -708,17 +708,25 @@ fn add_iamb_commands(cmds: &mut ProgramCommands) {
708708
});
709709
cmds.add_command(ProgramCommand {
710710
name: "chats".into(),
711-
aliases: vec![],
711+
aliases: vec!["c".into()],
712712
f: iamb_chats,
713713
});
714714
cmds.add_command(ProgramCommand { name: "dms".into(), aliases: vec![], f: iamb_dms });
715715
cmds.add_command(ProgramCommand {
716716
name: "download".into(),
717-
aliases: vec![],
717+
aliases: vec!["d".into()],
718718
f: iamb_download,
719719
});
720-
cmds.add_command(ProgramCommand { name: "open".into(), aliases: vec![], f: iamb_open });
721-
cmds.add_command(ProgramCommand { name: "edit".into(), aliases: vec![], f: iamb_edit });
720+
cmds.add_command(ProgramCommand {
721+
name: "open".into(),
722+
aliases: vec!["o".into()],
723+
f: iamb_open,
724+
});
725+
cmds.add_command(ProgramCommand {
726+
name: "edit".into(),
727+
aliases: vec!["e".into()],
728+
f: iamb_edit,
729+
});
722730
cmds.add_command(ProgramCommand {
723731
name: "invite".into(),
724732
aliases: vec![],
@@ -733,27 +741,27 @@ fn add_iamb_commands(cmds: &mut ProgramCommands) {
733741
});
734742
cmds.add_command(ProgramCommand {
735743
name: "members".into(),
736-
aliases: vec![],
744+
aliases: vec!["m".into()],
737745
f: iamb_members,
738746
});
739747
cmds.add_command(ProgramCommand {
740748
name: "react".into(),
741-
aliases: vec![],
749+
aliases: vec!["rc".into(), "reac".into(), "rct".into()],
742750
f: iamb_react,
743751
});
744752
cmds.add_command(ProgramCommand {
745753
name: "redact".into(),
746-
aliases: vec![],
754+
aliases: vec!["red".into()],
747755
f: iamb_redact,
748756
});
749757
cmds.add_command(ProgramCommand {
750758
name: "reply".into(),
751-
aliases: vec![],
759+
aliases: vec!["rep".into()],
752760
f: iamb_reply,
753761
});
754762
cmds.add_command(ProgramCommand {
755763
name: "rooms".into(),
756-
aliases: vec![],
764+
aliases: vec!["ro".into()],
757765
f: iamb_rooms,
758766
});
759767
cmds.add_command(ProgramCommand { name: "room".into(), aliases: vec![], f: iamb_room });
@@ -764,22 +772,22 @@ fn add_iamb_commands(cmds: &mut ProgramCommands) {
764772
});
765773
cmds.add_command(ProgramCommand {
766774
name: "spaces".into(),
767-
aliases: vec![],
775+
aliases: vec!["s".into()],
768776
f: iamb_spaces,
769777
});
770778
cmds.add_command(ProgramCommand {
771779
name: "unreads".into(),
772-
aliases: vec![],
780+
aliases: vec!["u".into()],
773781
f: iamb_unreads,
774782
});
775783
cmds.add_command(ProgramCommand {
776784
name: "unreact".into(),
777-
aliases: vec![],
785+
aliases: vec!["unr".into()],
778786
f: iamb_unreact,
779787
});
780788
cmds.add_command(ProgramCommand {
781-
name: "upload".into(),
782-
aliases: vec![],
789+
name: "up[load]".into(),
790+
aliases: vec!["up".into()],
783791
f: iamb_upload,
784792
});
785793
cmds.add_command(ProgramCommand {
@@ -794,7 +802,7 @@ fn add_iamb_commands(cmds: &mut ProgramCommands) {
794802
});
795803
cmds.add_command(ProgramCommand {
796804
name: "editor".into(),
797-
aliases: vec![],
805+
aliases: vec!["ed".into()],
798806
f: iamb_editor,
799807
});
800808
cmds.add_command(ProgramCommand {

0 commit comments

Comments
 (0)