Update readme and /help

This commit is contained in:
Tulir Asokan 2020-02-25 20:46:24 +02:00
parent a79de7ba76
commit 699d0ea4e0
2 changed files with 78 additions and 36 deletions

View File

@ -25,6 +25,9 @@ precompiled executables. For now, you can either download a CI build from
Simply pull changes (`git pull`) and run `go build` again to update. Simply pull changes (`git pull`) and run `go build` again to update.
## Debugging
If something doesn't work but it doesn't crash, check the `/tmp/gomuks/debug.log` file for any errors.
## Developing ## Developing
Set `DEBUG=1` to enable partial deadlock detection and to write panics to stdout instead of a file. Set `DEBUG=1` to enable partial deadlock detection and to write panics to stdout instead of a file.
@ -33,8 +36,9 @@ use `go install -race` and set `GORACE='history_size=7 log_path=/tmp/gomuks/race
when starting gomuks, then check `/tmp/gomuks/race.log.<pid>`. Note that race detection when starting gomuks, then check `/tmp/gomuks/race.log.<pid>`. Note that race detection
will use a lot of extra resources. will use a lot of extra resources.
For debugging, use `tail -f /tmp/gomuks/debug.log` and write to it using the Proper debuggers are too fancy, but normal prints won't work in a TUI application. To write to the
methods in the `maunium.net/go/gomuks/debug` package: debug log mentioned previously, use the `maunium.net/go/gomuks/debug` package:
```go ```go
package foo package foo
@ -55,16 +59,48 @@ func Foo() {
- jump to room - `Alt + Enter`, then `Tab` and `Enter` to navigate and select room - jump to room - `Alt + Enter`, then `Tab` and `Enter` to navigate and select room
### Commands ### Commands
* `/help` - View command list #### General
* `/me <text>` - Send an emote * `/help` - View command list.
* `/quit` - Close gomuks * `/quit` - Close gomuks.
* `/clearcache` - Clear room state and close gomuks * `/clearcache` - Clear room state and close gomuks.
* `/leave` - Leave the current room * `/logout` - Log out, clear caches and go back to the login view.
* `/create <room name>` - Create a new Matrix room. * `/toggle <rooms/users/baremessages/images/typingnotif>` - Change user preferences.
* `/join <room>` - Join the room with the given room ID or alias
* `/toggle <rooms/users/baremessages/images/typingnotif>` - Change user preferences #### Sending special messages
* `/logout` - Log out, clear caches and go back to the login view * `/me <text>` - Send an emote.
* `/send <room id> <event type> <content>` - Send a custom event * `/notice <text>` - Send a notice (generally used for bot messages).
* `/setstate <room id> <event type> <state key/-> <content>` - Change room state * `/rainbow <text>` - Send rainbow text (markdown not supported).
* `/msend <event type> <content>` - Send a custom event to the current room * `/rainbowme <text>` - Send rainbow text in an emote.
* `/msetstate <event type> <state key/-> <content>` - Change room state in the current room
#### Rooms
##### Creating
* `/pm <user id> [...]` - Start a private chat with the given user(s).
* `/create [room name]` - Create a new room.
##### Joining
* `/join <room> [server]` - Join the room with the given room ID or alias, optionally through the given server.
* `/accept` (in a room you're invited to) - Accept the invite.
* `/reject` (in a room you're invited to) - Reject the invite.
##### Existing
* `/invite <user id>` - Invite the given user ID to the room.
* `/roomnick <name>` - Change your per-room displayname.
* `/tag <tag> <priority>` - Add the room to `<tag>`. `<tag>` should start with `u.` and `<priority>`
should be a float between 0 and 1. Rooms are sorted in ascending priority order.
* `/untag <tag>` - Remove the room from `<tag>`.
* `/tags` - List the tags the room is in.
##### Leaving
* `/leave` - Leave the current room.
* `/kick <user id> [reason]` - Kick a user.
* `/ban <user id> [reason]` - Ban a user.
* `/unban <user id>` - Unban a user.
#### Raw events
* `/send <room id> <event type> <content>` - Send a custom event.
* `/setstate <room id> <event type> <state key/-> <content>` - Change room state.
* `/msend <event type> <content>` - Send a custom event to the current room.
* `/msetstate <event type> <state key/-> <content>` - Change room state in the current room.
* `/id` - Get the current room ID.
#### Debugging
* `/hprof` - Create a heap profile and write it to `gomuks.heap.prof` in the current directory.
* `/pprof <seconds>` - Profile the CPU usage for the given number of seconds and write it to `gomuks.cpu.prof`.
* `/trace <seconds>` - Trace calls for the given number of seconds and write traces to `gomuks.trace`.

View File

@ -284,31 +284,39 @@ func cmdUnknownCommand(cmd *Command) {
} }
func cmdHelp(cmd *Command) { func cmdHelp(cmd *Command) {
cmd.Reply(`/help - Show the temporary help message. cmd.Reply(`# General
/help - Show this "temporary" help message.
/quit - Quit gomuks.
/clearcache - Clear cache and quit gomuks.
/logout - Log out of Matrix.
/toggle <thing> - Temporary command to toggle various UI features.
/quit - Quit gomuks. Things: rooms, users, baremessages, images, typingnotif
/clearcache - Clear cache and quit gomuks.
/logout - Log out of Matrix.
/me <message> - Send an emote message. # Sending special messages
/rainbow <message> - Send a rainbow message (markdown not supported). /me <message> - Send an emote message.
/notice <message> - Send a notice (generally used for bot messages).
/rainbow <message> - Send rainbow text (markdown not supported).
/rainbowme <message> - Send rainbow text in an emote.
/create [room name] - Create a room. # Rooms
/pm <user id> <...> - Create a private chat with the given user(s). /pm <user id> <...> - Create a private chat with the given user(s).
/join <room address> - Join a room. /create [room name] - Create a room.
/leave - Leave the current room.
/invite <user id> - Invite a user. /join <room> [server] - Join a room.
/accept - Accept the invite.
/reject - Reject the invite.
/invite <user id> - Invite the given user to the room.
/roomnick <name> - Change your per-room displayname.
/tag <tag> <priority> - Add the room to <tag>.
/untag <tag> - Remove the room from <tag>.
/tags - List the tags the room is in.
/leave - Leave the current room.
/kick <user id> [reason] - Kick a user. /kick <user id> [reason] - Kick a user.
/ban <user id> [reason] - Ban a user. /ban <user id> [reason] - Ban a user.
/unban <user id> - Unban a user. /unban <user id> - Unban a user.`)
/send <room id> <type> <json> - Send a custom event to the given room.
/msend <type> <json> - Send a custom event to the current room.
/setstate <room id> <type> <key/-> <json> - Send a custom event to the given room.
/msetstate <type> <key/-> <json> - Send a custom event to the current room.
/toggle <thing> - Temporary command to toggle various UI features.`)
} }
func cmdLeave(cmd *Command) { func cmdLeave(cmd *Command) {
@ -432,7 +440,6 @@ func cmdMSendEvent(cmd *Command) {
} }
func cmdSendEvent(cmd *Command) { func cmdSendEvent(cmd *Command) {
debug.Print(cmd.Command, cmd.Args, len(cmd.Args))
if len(cmd.Args) < 3 { if len(cmd.Args) < 3 {
cmd.Reply("Usage: /send <room id> <event type> <content>") cmd.Reply("Usage: /send <room id> <event type> <content>")
return return
@ -440,7 +447,6 @@ func cmdSendEvent(cmd *Command) {
roomID := cmd.Args[0] roomID := cmd.Args[0]
eventType := mautrix.NewEventType(cmd.Args[1]) eventType := mautrix.NewEventType(cmd.Args[1])
rawContent := strings.Join(cmd.Args[2:], " ") rawContent := strings.Join(cmd.Args[2:], " ")
debug.Print(roomID, eventType, rawContent)
var content interface{} var content interface{}
err := json.Unmarshal([]byte(rawContent), &content) err := json.Unmarshal([]byte(rawContent), &content)