Skip to content

Commit 2506a24

Browse files
authored
Merge pull request #18 from reeflective/dev
Fixes and updates
2 parents f0b92fd + 4c403e7 commit 2506a24

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1293
-844
lines changed

camelcase.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,37 +42,37 @@ const (
4242
//
4343
// Examples
4444
//
45-
// "" => [""]
46-
// "lowercase" => ["lowercase"]
47-
// "Class" => ["Class"]
48-
// "MyClass" => ["My", "Class"]
49-
// "MyC" => ["My", "C"]
50-
// "HTML" => ["HTML"]
51-
// "PDFLoader" => ["PDF", "Loader"]
52-
// "AString" => ["A", "String"]
53-
// "SimpleXMLParser" => ["Simple", "XML", "Parser"]
54-
// "vimRPCPlugin" => ["vim", "RPC", "Plugin"]
55-
// "GL11Version" => ["GL11", "Version"]
56-
// "99Bottles" => ["99", "Bottles"]
57-
// "May5" => ["May5"]
58-
// "BFG9000" => ["BFG9000"]
59-
// "BöseÜberraschung" => ["Böse", "Überraschung"]
60-
// "Two spaces" => ["Two", " ", "spaces"]
61-
// "BadUTF8\xe2\xe2\xa1" => ["BadUTF8\xe2\xe2\xa1"]
45+
// "" => [""]
46+
// "lowercase" => ["lowercase"]
47+
// "Class" => ["Class"]
48+
// "MyClass" => ["My", "Class"]
49+
// "MyC" => ["My", "C"]
50+
// "HTML" => ["HTML"]
51+
// "PDFLoader" => ["PDF", "Loader"]
52+
// "AString" => ["A", "String"]
53+
// "SimpleXMLParser" => ["Simple", "XML", "Parser"]
54+
// "vimRPCPlugin" => ["vim", "RPC", "Plugin"]
55+
// "GL11Version" => ["GL11", "Version"]
56+
// "99Bottles" => ["99", "Bottles"]
57+
// "May5" => ["May5"]
58+
// "BFG9000" => ["BFG9000"]
59+
// "BöseÜberraschung" => ["Böse", "Überraschung"]
60+
// "Two spaces" => ["Two", " ", "spaces"]
61+
// "BadUTF8\xe2\xe2\xa1" => ["BadUTF8\xe2\xe2\xa1"]
6262
//
6363
// Splitting rules
6464
//
65-
// 1) If string is not valid UTF-8, return it without splitting as
65+
// 1. If string is not valid UTF-8, return it without splitting as
6666
// single item array.
67-
// 2) Assign all unicode characters into one of 4 sets: lower case
67+
// 2. Assign all unicode characters into one of 4 sets: lower case
6868
// letters, upper case letters, numbers, and all other characters.
69-
// 3) Iterate through characters of string, introducing splits
69+
// 3. Iterate through characters of string, introducing splits
7070
// between adjacent characters that belong to different sets.
71-
// 4) Iterate through array of split strings, and if a given string
71+
// 4. Iterate through array of split strings, and if a given string
7272
// is upper case:
73-
// if subsequent string is lower case:
74-
// move last character of upper case string to beginning of
75-
// lower case string
73+
// if subsequent string is lower case:
74+
// move last character of upper case string to beginning of
75+
// lower case string
7676
func split(src string) (entries []string) {
7777
// don't split invalid utf8
7878
if !utf8.ValidString(src) {

camelcase_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// The MIT License (MIT)
44
//
5-
// Copyright (c) 2015 Fatih Arslan
5+
// # Copyright (c) 2015 Fatih Arslan
66
//
77
// Permission is hereby granted, free of charge, to any person obtaining a copy of
88
// this software and associated documentation files (the "Software"), to deal in

example/example

489 KB
Binary file not shown.

example/opts/options.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ type Machines string
3131

3232
// Complete provides user@host completions.
3333
func (m *Machines) Complete(ctx carapace.Context) carapace.Action {
34-
if strings.Contains(ctx.CallbackValue, "@") {
35-
prefix := strings.SplitN(ctx.CallbackValue, "@", 2)[0]
34+
if strings.Contains(ctx.Value, "@") {
35+
prefix := strings.SplitN(ctx.Value, "@", 2)[0]
3636
return net.ActionHosts().Invoke(ctx).Prefix(prefix + "@").ToA()
3737
} else {
3838
return net.ActionHosts()

flags.go

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,27 @@
1212
// package main
1313
//
1414
// import (
15-
// "github.com/reeflective/flags/example/commands"
1615
//
17-
// "github.com/reeflective/flags"
18-
// genflags "github.com/reeflective/flags/gen/flags"
16+
// "github.com/reeflective/flags/example/commands"
1917
//
20-
// "github.com/reeflective/flags/validator"
21-
// "github.com/reeflective/flags/gen/completions"
22-
// )
18+
// "github.com/reeflective/flags"
19+
// genflags "github.com/reeflective/flags/gen/flags"
20+
//
21+
// "github.com/reeflective/flags/validator"
22+
// "github.com/reeflective/flags/gen/completions"
2323
//
24-
// func main() {
25-
// var opts []flags.OptFunc
24+
// )
2625
//
27-
// opts = append(opts, flags.Validator(validator.New()))
26+
// func main() {
27+
// var opts []flags.OptFunc
2828
//
29-
// rootData := &commands.Root{}
30-
// rootCmd := genflags.Generate(rootData, opts...)
29+
// opts = append(opts, flags.Validator(validator.New()))
3130
//
32-
// comps, _ := completions.Generate(rootCmd, rootData, nil)
33-
// }
31+
// rootData := &commands.Root{}
32+
// rootCmd := genflags.Generate(rootData, opts...)
3433
//
34+
// comps, _ := completions.Generate(rootCmd, rootData, nil)
35+
// }
3536
//
3637
// 2) Global parsing options (base) ------------------------------------------------------
3738
//
@@ -64,7 +65,6 @@
6465
// tag attached to them. This is because by default the library does not considers untagged field anymore.
6566
// func ParseAll()
6667
//
67-
//
6868
// 3) Special parsing options/functions---------------------------------------------------
6969
//
7070
// ValidateFunc describes a validation func, that takes string val for flag from command line,
@@ -73,24 +73,19 @@
7373
//
7474
// type ValidateFunc func(val string, field reflect.StructField, data interface{}) error
7575
//
76-
//
7776
// Validator sets validator function for flags.
7877
// Check existing validators in flags/validator and flags/validator/govalidator packages.
7978
//
8079
// func Validator(val ValidateFunc)
81-
//
82-
//
8380
// FlagFunc is a generic function that can be applied to each
8481
// value that will end up being a flags *Flag, so that users
8582
// can perform more arbitrary operations on each, such as checking
8683
// for completer implementations, bind to viper configurations, etc.
8784
//
8885
// type FlagFunc func(flag string, tag tag.MultiTag, val reflect.Value) error
8986
//
90-
//
9187
// FlagHandler sets the handler function for flags, in order to perform arbitrary
9288
// operations on the value of the flag identified by the <flag> name parameter of FlagFunc.
9389
//
9490
// func FlagHandler(val FlagFunc)
95-
//
9691
package flags

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/go-playground/validator/v10 v10.11.1
88
github.com/rsteube/carapace v0.30.0
99
github.com/rsteube/carapace-bin v0.19.0
10-
github.com/spf13/cobra v1.6.1
10+
github.com/spf13/cobra v1.7.0
1111
github.com/spf13/pflag v1.0.5
1212
github.com/stretchr/testify v1.8.0
1313
)
@@ -25,4 +25,4 @@ require (
2525
gopkg.in/yaml.v3 v3.0.1 // indirect
2626
)
2727

28-
replace github.com/rsteube/carapace v0.30.0 => github.com/reeflective/carapace v0.25.2-0.20230106225838-382407e213d4
28+
replace github.com/rsteube/carapace v0.30.0 => github.com/reeflective/carapace v0.25.2-0.20230416191807-fc9b8c3aa6f6

go.sum

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/j
1313
github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
1414
github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ=
1515
github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU=
16-
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
1716
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
1817
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
1918
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
@@ -29,16 +28,16 @@ github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ic
2928
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
3029
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
3130
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
32-
github.com/reeflective/carapace v0.25.2-0.20230106225838-382407e213d4 h1:FTPSPEnA0dklTQm61gv7gtYh85/WFqeJSSENa7BCdxk=
33-
github.com/reeflective/carapace v0.25.2-0.20230106225838-382407e213d4/go.mod h1:/ALYHicIpak6TjQnKl7HupclqJydy2LQb6CkawYBxDo=
31+
github.com/reeflective/carapace v0.25.2-0.20230416191807-fc9b8c3aa6f6 h1:3HHTRiXvaEz8iACxwlOBc9jHDYxYNvW60U63Q97/31w=
32+
github.com/reeflective/carapace v0.25.2-0.20230416191807-fc9b8c3aa6f6/go.mod h1:jkLt41Ne2TD2xPuMdX/2O05Smhy8vMgG7O2TYvC0yOc=
3433
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
3534
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
3635
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
3736
github.com/rsteube/carapace-bin v0.19.0 h1:pmWOrtO0Fz4G+55OKHjjA4ihIKZKzDZh3Z8X1pY8IBk=
3837
github.com/rsteube/carapace-bin v0.19.0/go.mod h1:yAF4advL85gx7ZFxYYsJu8Rgp2akz4TqvD6M0Bg0VGc=
3938
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
40-
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
41-
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
39+
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
40+
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
4241
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
4342
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
4443
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

vendor/github.com/rsteube/carapace/.dockerignore

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/rsteube/carapace/.goreleaser.yml

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)