mirror of
https://github.com/muesli/mastotool
synced 2025-06-05 22:09:22 +02:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
4a70999afb | |||
38812fa213 | |||
e57cb0710e |
@ -10,6 +10,7 @@ builds:
|
||||
goos:
|
||||
- linux
|
||||
- freebsd
|
||||
- openbsd
|
||||
- darwin
|
||||
- windows
|
||||
goarch:
|
||||
|
13
README.md
13
README.md
@ -6,14 +6,21 @@ mastotool
|
||||
[](http://goreportcard.com/report/muesli/mastotool)
|
||||
[](https://pkg.go.dev/github.com/muesli/mastotool)
|
||||
|
||||
mastotool offers a collection of tools to work with your Mastodon account
|
||||
mastotool offers a collection of command-line tools to work with your Mastodon account
|
||||
|
||||
## Installation
|
||||
|
||||
### Packages & Binaries
|
||||
### Packages
|
||||
|
||||
#### Linux
|
||||
- Arch Linux: [mastotool](https://aur.archlinux.org/packages/mastotool/)
|
||||
- [Binaries](https://github.com/muesli/mastotool/releases) for Linux, macOS & Windows
|
||||
- [Packages](https://github.com/muesli/mastotool/releases) in Debian & RPM formats
|
||||
|
||||
#### macOS
|
||||
- macOS with [Homebrew](https://brew.sh/): `brew tap muesli/tap && brew install mastotool`
|
||||
|
||||
### Binaries
|
||||
- [Binaries](https://github.com/muesli/mastotool/releases) for Linux, FreeBSD, OpenBSD, macOS & Windows
|
||||
|
||||
### From source
|
||||
|
||||
|
26
main.go
26
main.go
@ -22,6 +22,19 @@ var (
|
||||
Short: "mastotool offers a collection of tools to work with your Mastodon account",
|
||||
SilenceErrors: true,
|
||||
SilenceUsage: true,
|
||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
if err := initClient(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var err error
|
||||
self, err = client.GetAccountCurrentUser(context.Background())
|
||||
if err != nil {
|
||||
return fmt.Errorf("Can't retrieve user: %s", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@ -120,19 +133,8 @@ func initClient() error {
|
||||
func main() {
|
||||
RootCmd.PersistentFlags().StringVarP(&configFile, "config", "c", "mastodon.json", "uses the specified config file")
|
||||
|
||||
if err := initClient(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
var err error
|
||||
self, err = client.GetAccountCurrentUser(context.Background())
|
||||
if err != nil {
|
||||
fmt.Printf("Can't retrieve user: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err := RootCmd.Execute(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(-1)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user