diff --git a/cmd/mstdn/cmd_toot.go b/cmd/mstdn/cmd_toot.go index 7b7f08a..ff3db38 100644 --- a/cmd/mstdn/cmd_toot.go +++ b/cmd/mstdn/cmd_toot.go @@ -3,7 +3,6 @@ package main import ( "errors" "log" - "strings" "github.com/mattn/go-mastodon" "github.com/urfave/cli" @@ -23,7 +22,7 @@ func cmdToot(c *cli.Context) error { } toot = string(text) } else { - toot = strings.Join(c.Args().Tail(), " ") + toot = argstr(c) } client := c.App.Metadata["client"].(*mastodon.Client) _, err := client.PostStatus(&mastodon.Toot{ diff --git a/cmd/mstdn/main.go b/cmd/mstdn/main.go index b50977b..f920d82 100644 --- a/cmd/mstdn/main.go +++ b/cmd/mstdn/main.go @@ -143,6 +143,14 @@ func authenticate(client *mastodon.Client, config *mastodon.Config, file string) return nil } +func argstr(c *cli.Context) string { + a := []string{} + for i := 0; i < c.NArg(); i++ { + a = append(a, c.Args().Get(i)) + } + return strings.Join(a, " ") +} + func fatalIf(err error) { if err == nil { return @@ -207,6 +215,11 @@ func run() int { Usage: "show account information", Action: cmdAccount, }, + { + Name: "search", + Usage: "search content", + Action: cmdSearch, + }, } app.Run(os.Args) return 0