Skip to content

Commit

Permalink
feat(store): add extended glob filter (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
plastikfan committed Jan 11, 2024
1 parent 5eaa8c3 commit c1759a4
Show file tree
Hide file tree
Showing 7 changed files with 290 additions and 53 deletions.
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"bindnative",
"bodyclose",
"clif",
"cmds",
"cobrass",
"cogen",
"colors",
Expand Down Expand Up @@ -58,12 +59,14 @@
"rebinder",
"refl",
"repotoken",
"samber",
"Selectf",
"snivilised",
"staticcheck",
"structcheck",
"stylecheck",
"templatise",
"testcache",
"thelper",
"tmpl",
"tparallel",
Expand All @@ -72,7 +75,8 @@
"vactive",
"Validatable",
"varargs",
"varcheck"
"varcheck",
"watchv"
],
"files.associations": {
"**/*.tmpl": "go"
Expand Down
50 changes: 34 additions & 16 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,70 @@ vars:
DIST_DIR: ./dist

tasks:
# === build ================================================

b:
cmds:
- go build ./...

t:
clean:
cmds:
- go test ./...
- go clean

dry:
cmds:
- ginkgo -v --dry-run ./...
# === test =================================================

watchv:
t:
cmds:
- ginkgo watch -v -r -p ./...
- go test ./...

watch:
clean-t:
cmds:
- ginkgo watch -r -p ./...
- go clean -testcache

# initialise a test suite for a package. (only 1 per package)
boot:
dry:
cmds:
- ginkgo bootstrap
- ginkgo -v --dry-run ./...

# run tests suites recursive
g:
cmds:
- ginkgo -r

# run tests suites recursive with verbose
gv:
cmds:
- ginkgo -r -v

# invoke as task gen -- <item>
gl:
cmds:
- ginkgo -r --label-filter={{.CLI_ARGS}}

# run tests suites recursive with verbose
gv:
# === watch ================================================

watchv:
cmds:
- ginkgo -r -v
- ginkgo watch -v -r -p ./...

watch:
cmds:
- ginkgo watch -r -p ./...

# === ginkgo =================================================

# initialise a test suite for a package. (only 1 per package)
boot:
cmds:
- ginkgo bootstrap

# generate a test file for the item provided (item_test.go)
# invoke as task gen -- <item>
gen:
cmds:
- ginkgo generate {{.CLI_ARGS}}

# === lint ===================================================

lint:
cmds:
- golangci-lint run
Expand Down Expand Up @@ -99,7 +117,7 @@ tasks:
cmds:
- cobrass-gen -sign

# === build/deploy code generator ===========================
# === build/deploy code generator ============================

b-gen-linux:
cmds:
Expand Down
40 changes: 34 additions & 6 deletions src/assistant/i18n/messages-command.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,55 @@ func (td FilesRegExParamUsageTemplData) Message() *Message {
}
}

// FolderGlobParamUsageTemplData
// FilesExGlobParamUsageTemplData
// 🧊
type FolderGlobParamUsageTemplData struct {
type FilesExGlobParamUsageTemplData struct {
CobrassTemplData
}

func (td FolderGlobParamUsageTemplData) Message() *Message {
func (td FilesExGlobParamUsageTemplData) Message() *Message {
return &Message{
ID: "files-ex-glob-filter.param-usage",
Description: "files extended glob filter (negate-able with leading !)",
Other: "files extended glob filter: <glob>|<suffixes csv> (negate-able with leading !)",
}
}

// FoldersExGlobParamUsageTemplData
// 🧊
type FoldersExGlobParamUsageTemplData struct {
CobrassTemplData
}

func (td FoldersExGlobParamUsageTemplData) Message() *Message {
return &Message{
ID: "folders-ex-glob-filter.param-usage",
Description: "folders extended glob filter (negate-able with leading !)",
Other: "folders extended glob filter: <glob> (negate-able with leading !)",
}
}

// FoldersGlobParamUsageTemplData
// 🧊
type FoldersGlobParamUsageTemplData struct {
CobrassTemplData
}

func (td FoldersGlobParamUsageTemplData) Message() *Message {
return &Message{
ID: "folders-glob-filter.param-usage",
Description: "folders glob (negate-able with leading !)",
Other: "folders-gb folder glob filter (negate-able with leading !)",
}
}

// FolderRexExParamUsageTemplData
// FoldersRexExParamUsageTemplData
// 🧊
type FolderRexExParamUsageTemplData struct {
type FoldersRexExParamUsageTemplData struct {
CobrassTemplData
}

func (td FolderRexExParamUsageTemplData) Message() *Message {
func (td FoldersRexExParamUsageTemplData) Message() *Message {
return &Message{
ID: "folders-regex-filter.param-usage",
Description: "folders regex filter (negate-able with leading !)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"github.com/snivilised/extendio/i18n"
)

// The code for these messages needs to be generated not hand coded. We
// should be able enter data into a static array and then generate the messages.

// These are user facing errors messages that occur due to
// incorrect use of the cli application. They occur as a result
// of validating the user provided options on the command line.
Expand Down Expand Up @@ -467,3 +470,42 @@ func NewAtMostOptValidationError(flag string, value, threshold any) AtMostOptVal
},
}
}

// ❌ InvalidExtendedGlobFilterTemplData

// AtMostOptValidationTemplData
type InvalidExtendedGlobFilterTemplData struct {
CobrassTemplData
Delimiter string
}

func (td InvalidExtendedGlobFilterTemplData) Message() *i18n.Message {
return &i18n.Message{
ID: "invalid-extended-glob-filter.cobrass",
Description: "Invalid extended glob filter definition (missing delimiter)",
Other: "option validation failed, glob filter definition missing delimiter '{{.Delimiter}}'",
}
}

type InvalidExtendedGlobFilterBehaviourQuery interface {
error
IsInvalidExtendedGlobFilter() bool
}

type InvalidExtendedGlobFilterValidation struct {
i18n.LocalisableError
}

func (e InvalidExtendedGlobFilterValidation) IsInvalidExtendedGlobFilter() bool {
return true
}

func NewInvalidExtendedGlobFilterValidationError(delimiter string) InvalidExtendedGlobFilterBehaviourQuery {
return &InvalidExtendedGlobFilterValidation{
LocalisableError: i18n.LocalisableError{
Data: InvalidExtendedGlobFilterTemplData{
Delimiter: delimiter,
},
},
}
}
Loading

0 comments on commit c1759a4

Please sign in to comment.