mirror of
https://github.com/muesli/mastotool
synced 2025-06-05 22:09:22 +02:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
8404cea804 | |||
562038db56 | |||
4a70999afb | |||
38812fa213 | |||
e57cb0710e |
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -5,7 +5,7 @@ jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.13.x, 1.14.x, 1.15.x]
|
||||
go-version: [~1.13, ^1]
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
|
@ -5,11 +5,14 @@ before:
|
||||
- go mod download
|
||||
builds:
|
||||
- id: "mastotool"
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
binary: mastotool
|
||||
ldflags: -s -w -X main.Version={{ .Version }} -X main.CommitSHA={{ .Commit }}
|
||||
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