initial commit
This commit is contained in:
36
cmd/oslstats/main.go
Normal file
36
cmd/oslstats/main.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"git.haelnorr.com/h/oslstats/internal/config"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func main() {
|
||||
flags := config.SetupFlags()
|
||||
ctx := context.Background()
|
||||
|
||||
cfg, loader, err := config.GetConfig(flags)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%s\n", errors.Wrap(err, "Failed to load config"))
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if flags.EnvDoc || flags.ShowEnv {
|
||||
loader.PrintEnvVarsStdout(flags.ShowEnv)
|
||||
return
|
||||
}
|
||||
|
||||
if flags.GenEnv != "" {
|
||||
loader.GenerateEnvFile(flags.GenEnv, true)
|
||||
return
|
||||
}
|
||||
|
||||
if err := run(ctx, os.Stdout, cfg); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user