FILE / ScuroNeko/est
internal/config/flags.go
Исходный файл и его история в репозитории.
23 lines
457 B
Go
23 lines
457 B
Go
package config
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/spf13/pflag"
|
|
)
|
|
|
|
// Flags contains command-line options accepted by est.
|
|
type Flags struct {
|
|
ConfigPath string
|
|
}
|
|
|
|
// ParseFlags parses est command-line flags.
|
|
func ParseFlags() (*Flags, error) {
|
|
configPath := pflag.StringP("config", "c", "./config.toml", "toml config path")
|
|
pflag.Parse()
|
|
if configPath == nil {
|
|
return nil, errors.New("no config path")
|
|
}
|
|
return &Flags{ConfigPath: *configPath}, nil
|
|
}
|