package cuiargs import ( "fmt" "regexp" models "gitea.likemath.ru/alex/gogrep/internal/models" ) // ProcessConsoleArguments fills internal grep config // Returns error if arguments filling is correct, but arguments are incorrect // Panics and shows info if arguments are invalid func ProcessConsoleArguments() (*models.GrepConfigInternal, error) { res := &models.GrepConfigInternal{} var err error pathPattern := "git/hook" res.PathPattern, err = regexp.Compile(pathPattern) if err != nil { return nil, fmt.Errorf("unable to compile path pattern Regexp: %v", pathPattern) } textPattern := "the commit" res.TextPattern, err = regexp.Compile(textPattern) if err != nil { return nil, fmt.Errorf("unable to compile text pattern Regexp: %v", textPattern) } return res, nil }