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:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: [1.13.x, 1.14.x, 1.15.x]
|
go-version: [~1.13, ^1]
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
env:
|
env:
|
||||||
|
@ -5,11 +5,14 @@ before:
|
|||||||
- go mod download
|
- go mod download
|
||||||
builds:
|
builds:
|
||||||
- id: "mastotool"
|
- id: "mastotool"
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
binary: mastotool
|
binary: mastotool
|
||||||
ldflags: -s -w -X main.Version={{ .Version }} -X main.CommitSHA={{ .Commit }}
|
ldflags: -s -w -X main.Version={{ .Version }} -X main.CommitSHA={{ .Commit }}
|
||||||
goos:
|
goos:
|
||||||
- linux
|
- linux
|
||||||
- freebsd
|
- freebsd
|
||||||
|
- openbsd
|
||||||
- darwin
|
- darwin
|
||||||
- windows
|
- windows
|
||||||
goarch:
|
goarch:
|
||||||
|
13
README.md
13
README.md
@ -6,14 +6,21 @@ mastotool
|
|||||||
[](http://goreportcard.com/report/muesli/mastotool)
|
[](http://goreportcard.com/report/muesli/mastotool)
|
||||||
[](https://pkg.go.dev/github.com/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
|
## Installation
|
||||||
|
|
||||||
### Packages & Binaries
|
### Packages
|
||||||
|
|
||||||
|
#### Linux
|
||||||
- Arch Linux: [mastotool](https://aur.archlinux.org/packages/mastotool/)
|
- 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
|
### 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",
|
Short: "mastotool offers a collection of tools to work with your Mastodon account",
|
||||||
SilenceErrors: true,
|
SilenceErrors: true,
|
||||||
SilenceUsage: 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() {
|
func main() {
|
||||||
RootCmd.PersistentFlags().StringVarP(&configFile, "config", "c", "mastodon.json", "uses the specified config file")
|
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 {
|
if err := RootCmd.Execute(); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
os.Exit(-1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user