You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
645 B
Go
36 lines
645 B
Go
package main
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
|
|
"git.freecumextremist.com/grumbulon/millionsmustbot/internal"
|
|
)
|
|
|
|
func main() {
|
|
if _, err := run(os.Args); err != nil {
|
|
if errors.Is(err, ErrNotError) || strings.Contains(err.Error(), "help requested") {
|
|
os.Exit(0)
|
|
} else {
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
}
|
|
|
|
func run(args []string) (opts *internal.Options, err error) {
|
|
opts, err = internal.ParseCLI(args, "DEV")
|
|
if err != nil {
|
|
return opts, fmt.Errorf("parse: %w", err)
|
|
}
|
|
cfg, err := internal.GetAuthStuff(opts)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
internal.Post(*cfg)
|
|
return opts, err
|
|
}
|
|
|
|
var ErrNotError = errors.New("not an error")
|