ref: deca7cb9a06428b469994384c614ea992e776e24
parent: 162c733fdd42ec8d872931375a96a9fe755efb4a
author: penny <penny@limitedideas.org>
date: Sun Sep 28 15:26:57 EDT 2025
implement /help command
--- a/commands.go
+++ b/commands.go
@@ -4,7 +4,7 @@
"strings"
)
-var commands = []string{"examine", "reply", "like", "thread", "open", "prev", "download", "dm", "rt", "parent", "children", "rm", "mark", "unmark", "account", "vim", "import", "pause", "resume", "url", "fpost", "ufpost", "edit", "notice", "stats", "next", "preview", "bookmarks", "follow", "unfollow", "likes"}+var commands = []string{"examine", "reply", "like", "thread", "open", "prev", "download", "dm", "rt", "parent", "children", "rm", "mark", "unmark", "account", "import", "pause", "resume", "url", "fpost", "ufpost", "edit", "notice", "stats", "next", "preview", "bookmarks", "follow", "unfollow", "likes", "help"} func processInput(input string) (command string, arguments string, found bool) {--- /dev/null
+++ b/help.go
@@ -1,0 +1,45 @@
+package main
+
+func helpString() string {+ return `Lines with no command are sent as a post.
+ Most commands that take <index> will operate on the most recently interacted with status,
+ if no index is passed.
+ Posts with multiple arguments may accept "." to operate on recent status.
+
+ ctrl-j Enable and disable multi-line mode
+ /help Show this help message.
+ /reply <index> content Reply to status by index.
+ /like <index> Favorite status by index.
+ /thread <index> View thread the indexed status is part of.
+ /open <index> Open indexed status in the system web browser.
+ /download <index> Download attached files/media from status.
+ /dm <content> Create a status with direct visibility (e.g. a dm).
+ /rt <index> Boost a status by index.
+ /parent <index> View parent of status by index.
+ /rm [index] Delete status by index, deletes most recent post without an argument.
+ /mark <index> Bookmark status by index.
+ /unmark <index> Unbookmark status.
+ /account [index] [account] View account details and status, either by index or name.
+ /pause Pause the streaming timeline or unpause it.
+ Pressing enter on an empty line will also unpause.
+
+ /resume Explicitly unpause the timeline.
+ /url <index> [url tag] Open URL from status content.
+ If no tag is provided, will open the first url.
+
+ /fpost <index> Add status to account's filters.
+ /ufpost <index> Unfilter status.
+ /edit <index> [content] Set targeted status to [content].
+ Use without content argument to load post into input bar.
+
+ /notice Prints unread notifications.
+ If there are none unread, opens notification page.
+
+ /stats Print some running stats.
+ /preview <index> Open attached media in system media viewer.
+ /bookmarks Open bookmarks page.
+ /follow [index] [account] Follow account by post index or name.
+ /unfollow [index] [account] Unfollow account by post index or name.
+ /likes Display favorited status page.
+`
+}
--- a/main.go
+++ b/main.go
@@ -103,6 +103,9 @@
//Contextual commands that need to handle their own requirements
switch command {+ case "help":
+ fmt.Println(hyphenate(helpString()))
+ return
case "stats":
hc.stats.slock.Lock()
var sb strings.Builder
@@ -374,7 +377,7 @@
}
}
var relationship *mastodon.Relationship
- unfollowfunc := func(job *GenericJob){ relationship, err = hc.client.AccountUnfollow(context.Background(), account.ID) }+ unfollowfunc := func(job *GenericJob) { relationship, err = hc.client.AccountUnfollow(context.Background(), account.ID) }unfollowjob := hc.dispatchFunc(unfollowfunc)
unfollowjob.Wait()
if err != nil {@@ -387,7 +390,7 @@
}
fmt.Printf("Unknown failure, account is still followed\n")return
-
+
case "follow":
var account *mastodon.Account
if foundindex {@@ -399,7 +402,7 @@
}
}
var relationship *mastodon.Relationship
- followfunc := func(job *GenericJob){ relationship, err = hc.client.AccountFollow(context.Background(), account.ID) }+ followfunc := func(job *GenericJob) { relationship, err = hc.client.AccountFollow(context.Background(), account.ID) }followjob := hc.dispatchFunc(followfunc)
followjob.Wait()
if err != nil {--- a/mastodon.go
+++ b/mastodon.go
@@ -510,7 +510,9 @@
func (hc *Hellclient) resolveAccount(lookup string) *mastodon.Account {var accounts []*mastodon.Account
var err error
- searchfunc := func(job *GenericJob){accounts, err = hc.client.AccountsSearchResolve(context.Background(), lookup, 1, true)}+ searchfunc := func(job *GenericJob) {+ accounts, err = hc.client.AccountsSearchResolve(context.Background(), lookup, 1, true)
+ }
searchjob := hc.dispatchFunc(searchfunc)
searchjob.Wait()
if err != nil {--- a/pages.go
+++ b/pages.go
@@ -19,7 +19,6 @@
type ProfileLoader struct {client *mastodon.Client
-
}
type BasicStatusGetter struct {@@ -89,10 +88,10 @@
//our previous index for going back
previndexes []int
//Semantic page number for the UI
- page int
+ page int
//don't flip the order around
disablereverse bool
- itembuffer *[]PageItem
+ itembuffer *[]PageItem
}
type NotificationPages struct {hc *Hellclient
@@ -158,7 +157,6 @@
return &itemArray
}
-
func findIndex(height int, items []PageItem) (index int, bumped bool) {linecount := 5
for i, _ := range items {@@ -244,7 +242,7 @@
page.findIndexEnd()
var items []PageItem
items = (*page.itembuffer)[page.index:page.indexend]
-
+
if !page.disablereverse {items = reverseArray(items)
}
--
⑨