feat(strct-tags): add support for tag options (#126)
* feat(struct_tags): add options support * refactor(struct-tags): give input field better name * feat(struct-tag): add default option * refactor: make it work on neovim version below 0.12 * chore(struct-tags): update the demo * refactor: unite struct_tags util with main logic
This commit is contained in:
parent
0de1892ca9
commit
7a18d9f7bd
19 changed files with 301 additions and 15 deletions
8
spec/fixtures/tags/overwrite_default_option_input.go
vendored
Normal file
8
spec/fixtures/tags/overwrite_default_option_input.go
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
package main
|
||||
|
||||
type Test struct {
|
||||
ID int
|
||||
Another struct {
|
||||
Second string
|
||||
}
|
||||
}
|
||||
8
spec/fixtures/tags/overwrite_default_option_output.go
vendored
Normal file
8
spec/fixtures/tags/overwrite_default_option_output.go
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
package main
|
||||
|
||||
type Test struct {
|
||||
ID int `xml:"id,otheroption"`
|
||||
Another struct {
|
||||
Second string `xml:"second,otheroption"`
|
||||
} `xml:"another,otheroption"`
|
||||
}
|
||||
11
spec/fixtures/tags/remove_with_option_input.go
vendored
Normal file
11
spec/fixtures/tags/remove_with_option_input.go
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package main
|
||||
|
||||
type Test struct {
|
||||
ID int `json:"id,omitempty" xml:"id,someoption"`
|
||||
Name string `json:"name,omitempty" xml:"name,someoption"`
|
||||
Num int64 `json:"num,omitempty" xml:"num,someoption"`
|
||||
Another struct {
|
||||
First int `json:"first,omitempty" xml:"first,someoption"`
|
||||
Second string `json:"second,omitempty" xml:"second,someoption"`
|
||||
} `json:"another,omitempty" xml:"another,someoption"`
|
||||
}
|
||||
11
spec/fixtures/tags/remove_with_option_output.go
vendored
Normal file
11
spec/fixtures/tags/remove_with_option_output.go
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package main
|
||||
|
||||
type Test struct {
|
||||
ID int `xml:"id,someoption"`
|
||||
Name string `xml:"name,someoption"`
|
||||
Num int64 `xml:"num,someoption"`
|
||||
Another struct {
|
||||
First int `xml:"first,someoption"`
|
||||
Second string `xml:"second,someoption"`
|
||||
} `xml:"another,someoption"`
|
||||
}
|
||||
8
spec/fixtures/tags/with_default_option_input.go
vendored
Normal file
8
spec/fixtures/tags/with_default_option_input.go
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
package main
|
||||
|
||||
type Test struct {
|
||||
ID int
|
||||
Another struct {
|
||||
Second string
|
||||
}
|
||||
}
|
||||
8
spec/fixtures/tags/with_default_option_output.go
vendored
Normal file
8
spec/fixtures/tags/with_default_option_output.go
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
package main
|
||||
|
||||
type Test struct {
|
||||
ID int `xml:"id,theoption"`
|
||||
Another struct {
|
||||
Second string `xml:"second,theoption"`
|
||||
} `xml:"another,theoption"`
|
||||
}
|
||||
11
spec/fixtures/tags/with_option_input.go
vendored
Normal file
11
spec/fixtures/tags/with_option_input.go
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package main
|
||||
|
||||
type Test struct {
|
||||
ID int
|
||||
Name string
|
||||
Num int64
|
||||
Another struct {
|
||||
First int
|
||||
Second string
|
||||
}
|
||||
}
|
||||
11
spec/fixtures/tags/with_option_output.go
vendored
Normal file
11
spec/fixtures/tags/with_option_output.go
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package main
|
||||
|
||||
type Test struct {
|
||||
ID int `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Num int64 `json:"num,omitempty"`
|
||||
Another struct {
|
||||
First int `json:"first,omitempty"`
|
||||
Second string `json:"second,omitempty"`
|
||||
} `json:"another,omitempty"`
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue