diff options
| author | ayyansea <ayyansea@gmail.com> | 2024-12-03 22:56:30 +0300 |
|---|---|---|
| committer | ayyansea <ayyansea@gmail.com> | 2024-12-03 22:56:30 +0300 |
| commit | aa2b92b7bb3a790d5d157dac95706a390ca4997c (patch) | |
| tree | 18e3bafbc545991c7fffc59ff61405972fdc84ab /cmd/uptfs/main.go | |
| parent | 11a101fc1706c184dcd6047e72a267c229fca671 (diff) | |
feat: add -f argument and filter appending logic
Diffstat (limited to 'cmd/uptfs/main.go')
| -rw-r--r-- | cmd/uptfs/main.go | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/cmd/uptfs/main.go b/cmd/uptfs/main.go index 5738131..5bc1a54 100644 --- a/cmd/uptfs/main.go +++ b/cmd/uptfs/main.go @@ -15,8 +15,9 @@ import ( ) var args struct { - ConfigFile string `arg:"-c" help:"path to config file" default:""` - Verbose bool `arg:"-v" help:"toggle verbose (debug) mode"` + ConfigFile string `arg:"-c" help:"path to config file" default:""` + Verbose bool `arg:"-v" help:"toggle verbose (debug) mode"` + Filter []string `arg:"-f,separate" help:"name of a filter that will be applied to text, can be specified multiple times"` } func errExit(err error) { @@ -34,18 +35,20 @@ func main() { slog.Debug("uptfs started") var configFilePath string + + var config config.Config var err error if args.ConfigFile != "" { configFilePath, err = filepath.Abs(args.ConfigFile) + config.LoadConfig(configFilePath) slog.Debug("config file path: " + configFilePath) } if err != nil { - errExit(err) + slog.Error(err.Error()) } - var config config.Config - config.LoadConfig(configFilePath) + config.Filters = append(config.Filters, args.Filter...) var inputStrings []string scanner := bufio.NewScanner(os.Stdin) |
