From be8f589c325e7a7d78c753a2571577eb76cba4ad Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Fri, 13 Dec 2019 11:29:12 +0100 Subject: update dependencies --- vendor/github.com/integrii/flaggy/.gitignore | 2 + vendor/github.com/integrii/flaggy/README.md | 34 +- .../github.com/integrii/flaggy/argumentParser.go | 8 +- vendor/github.com/integrii/flaggy/main.go | 12 + vendor/github.com/integrii/flaggy/parsedValue.go | 23 + vendor/github.com/integrii/flaggy/parser.go | 96 +- vendor/github.com/integrii/flaggy/subCommand.go | 109 +- vendor/github.com/jesseduffield/pty/types.go | 10 - .../jesseduffield/pty/types_dragonfly.go | 17 - .../github.com/jesseduffield/pty/types_freebsd.go | 15 - .../github.com/jesseduffield/pty/types_openbsd.go | 14 - .../jesseduffield/termbox-go/syscalls.go | 39 - .../go-windows-terminal-sequences/README.md | 1 + .../sequences_dummy.go | 11 + vendor/github.com/mattn/go-isatty/go.mod | 4 +- vendor/github.com/mattn/go-isatty/go.sum | 6 +- vendor/github.com/mattn/go-isatty/isatty_plan9.go | 2 +- vendor/github.com/mattn/go-runewidth/runewidth.go | 13 +- vendor/github.com/pelletier/go-toml/.gitignore | 3 + .../github.com/pelletier/go-toml/CONTRIBUTING.md | 132 + vendor/github.com/pelletier/go-toml/Dockerfile | 11 + .../pelletier/go-toml/PULL_REQUEST_TEMPLATE.md | 5 + vendor/github.com/pelletier/go-toml/README.md | 38 +- .../pelletier/go-toml/azure-pipelines.yml | 167 + vendor/github.com/pelletier/go-toml/benchmark.sh | 5 +- vendor/github.com/pelletier/go-toml/doc.go | 2 +- vendor/github.com/pelletier/go-toml/fuzzit.sh | 26 + vendor/github.com/pelletier/go-toml/go.mod | 9 + vendor/github.com/pelletier/go-toml/go.sum | 11 + vendor/github.com/pelletier/go-toml/keysparsing.go | 136 +- vendor/github.com/pelletier/go-toml/lexer.go | 46 +- vendor/github.com/pelletier/go-toml/localtime.go | 281 + vendor/github.com/pelletier/go-toml/marshal.go | 399 +- .../go-toml/marshal_OrderPreserve_test.toml | 39 + .../github.com/pelletier/go-toml/marshal_test.toml | 1 + vendor/github.com/pelletier/go-toml/parser.go | 73 +- vendor/github.com/pelletier/go-toml/test.sh | 88 - vendor/github.com/pelletier/go-toml/token.go | 13 +- vendor/github.com/pelletier/go-toml/toml.go | 120 +- .../github.com/pelletier/go-toml/tomltree_write.go | 300 +- vendor/github.com/spf13/afero/copyOnWriteFs.go | 5 +- vendor/github.com/spf13/afero/go.mod | 2 + vendor/github.com/spf13/afero/go.sum | 2 + vendor/github.com/spf13/afero/unionFile.go | 19 +- .../github.com/spf13/jwalterweatherman/.gitignore | 2 + .../spf13/jwalterweatherman/default_notepad.go | 30 +- vendor/github.com/spf13/jwalterweatherman/go.mod | 6 + .../spf13/jwalterweatherman/log_counter.go | 51 +- .../github.com/spf13/jwalterweatherman/notepad.go | 57 +- vendor/github.com/spf13/pflag/README.md | 4 +- vendor/github.com/spf13/pflag/bool_slice.go | 38 + vendor/github.com/spf13/pflag/count.go | 4 +- vendor/github.com/spf13/pflag/duration_slice.go | 38 + vendor/github.com/spf13/pflag/flag.go | 16 +- vendor/github.com/spf13/pflag/float32_slice.go | 174 + vendor/github.com/spf13/pflag/float64_slice.go | 166 + vendor/github.com/spf13/pflag/go.mod | 3 + vendor/github.com/spf13/pflag/go.sum | 0 vendor/github.com/spf13/pflag/int32_slice.go | 174 + vendor/github.com/spf13/pflag/int64_slice.go | 166 + vendor/github.com/spf13/pflag/int_slice.go | 30 + vendor/github.com/spf13/pflag/ip_slice.go | 40 +- vendor/github.com/spf13/pflag/string_array.go | 26 + vendor/github.com/spf13/pflag/string_slice.go | 22 +- vendor/github.com/spf13/pflag/string_to_int64.go | 149 + vendor/github.com/spf13/pflag/uint_slice.go | 42 + vendor/github.com/spf13/viper/.gitignore | 47 +- vendor/github.com/spf13/viper/Makefile | 71 + vendor/github.com/spf13/viper/README.md | 79 +- vendor/github.com/spf13/viper/go.mod | 2 + vendor/github.com/spf13/viper/go.sum | 12 + vendor/github.com/spf13/viper/util.go | 6 +- vendor/github.com/spf13/viper/viper.go | 195 +- vendor/golang.org/x/crypto/ssh/certs.go | 35 +- vendor/golang.org/x/crypto/ssh/keys.go | 280 +- vendor/golang.org/x/crypto/ssh/server.go | 4 +- vendor/golang.org/x/sys/cpu/cpu_arm64.go | 134 + vendor/golang.org/x/sys/cpu/cpu_arm64.s | 31 + vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go | 11 + vendor/golang.org/x/sys/cpu/cpu_gccgo.c | 43 - vendor/golang.org/x/sys/cpu/cpu_gccgo.go | 26 - vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go | 11 + vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c | 43 + vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go | 26 + vendor/golang.org/x/sys/cpu/cpu_linux.go | 48 +- vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go | 8 +- vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go | 9 + vendor/golang.org/x/sys/cpu/cpu_mips64x.go | 2 - vendor/golang.org/x/sys/cpu/cpu_mipsx.go | 2 - vendor/golang.org/x/sys/cpu/cpu_other_arm64.go | 2 - vendor/golang.org/x/sys/cpu/cpu_riscv64.go | 9 + vendor/golang.org/x/sys/cpu/cpu_wasm.go | 2 - vendor/golang.org/x/sys/cpu/hwcap_linux.go | 56 + vendor/golang.org/x/sys/unix/mkall.sh | 2 +- vendor/golang.org/x/sys/unix/mkasm_darwin.go | 78 - vendor/golang.org/x/sys/unix/mkerrors.sh | 6 +- vendor/golang.org/x/sys/unix/mkpost.go | 122 - vendor/golang.org/x/sys/unix/mksyscall.go | 402 -- vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go | 415 -- .../golang.org/x/sys/unix/mksyscall_aix_ppc64.go | 614 --- vendor/golang.org/x/sys/unix/mksyscall_solaris.go | 335 -- vendor/golang.org/x/sys/unix/mksysctl_openbsd.go | 355 -- vendor/golang.org/x/sys/unix/mksysnum.go | 190 - vendor/golang.org/x/sys/unix/syscall_netbsd.go | 10 + vendor/golang.org/x/sys/unix/types_aix.go | 237 - vendor/golang.org/x/sys/unix/types_darwin.go | 283 - vendor/golang.org/x/sys/unix/types_dragonfly.go | 263 - vendor/golang.org/x/sys/unix/types_freebsd.go | 400 -- vendor/golang.org/x/sys/unix/types_netbsd.go | 290 - vendor/golang.org/x/sys/unix/types_openbsd.go | 283 - vendor/golang.org/x/sys/unix/types_solaris.go | 266 - vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go | 12 +- vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go | 12 +- vendor/golang.org/x/sys/unix/zerrors_linux_386.go | 5569 +++++++++---------- .../golang.org/x/sys/unix/zerrors_linux_amd64.go | 5569 +++++++++---------- vendor/golang.org/x/sys/unix/zerrors_linux_arm.go | 5581 +++++++++---------- .../golang.org/x/sys/unix/zerrors_linux_arm64.go | 5555 +++++++++---------- vendor/golang.org/x/sys/unix/zerrors_linux_mips.go | 5573 +++++++++---------- .../golang.org/x/sys/unix/zerrors_linux_mips64.go | 5573 +++++++++---------- .../x/sys/unix/zerrors_linux_mips64le.go | 5573 +++++++++---------- .../golang.org/x/sys/unix/zerrors_linux_mipsle.go | 5573 +++++++++---------- .../golang.org/x/sys/unix/zerrors_linux_ppc64.go | 5691 ++++++++++---------- .../golang.org/x/sys/unix/zerrors_linux_ppc64le.go | 5691 ++++++++++---------- .../golang.org/x/sys/unix/zerrors_linux_riscv64.go | 5543 +++++++++---------- .../golang.org/x/sys/unix/zerrors_linux_s390x.go | 5689 +++++++++---------- .../golang.org/x/sys/unix/zerrors_linux_sparc64.go | 5669 +++++++++---------- vendor/golang.org/x/sys/unix/zptrace386_linux.go | 80 - .../golang.org/x/sys/unix/zptrace_armnn_linux.go | 41 + .../golang.org/x/sys/unix/zptrace_linux_arm64.go | 17 + .../golang.org/x/sys/unix/zptrace_mipsnn_linux.go | 50 + .../x/sys/unix/zptrace_mipsnnle_linux.go | 50 + vendor/golang.org/x/sys/unix/zptrace_x86_linux.go | 80 + vendor/golang.org/x/sys/unix/zptracearm_linux.go | 41 - vendor/golang.org/x/sys/unix/zptracemips_linux.go | 50 - .../golang.org/x/sys/unix/zptracemipsle_linux.go | 50 - .../golang.org/x/sys/unix/zsyscall_netbsd_386.go | 25 + .../golang.org/x/sys/unix/zsyscall_netbsd_amd64.go | 25 + .../golang.org/x/sys/unix/zsyscall_netbsd_arm.go | 25 + .../golang.org/x/sys/unix/zsyscall_netbsd_arm64.go | 25 + vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go | 1 + .../golang.org/x/sys/unix/zsysnum_linux_mips64.go | 1 + .../x/sys/unix/zsysnum_linux_mips64le.go | 1 + .../golang.org/x/sys/unix/zsysnum_linux_mipsle.go | 1 + vendor/golang.org/x/sys/unix/ztypes_linux_386.go | 59 +- vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go | 60 +- vendor/golang.org/x/sys/unix/ztypes_linux_arm.go | 60 +- vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go | 60 +- vendor/golang.org/x/sys/unix/ztypes_linux_mips.go | 60 +- .../golang.org/x/sys/unix/ztypes_linux_mips64.go | 61 +- .../golang.org/x/sys/unix/ztypes_linux_mips64le.go | 61 +- .../golang.org/x/sys/unix/ztypes_linux_mipsle.go | 60 +- vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go | 60 +- .../golang.org/x/sys/unix/ztypes_linux_ppc64le.go | 60 +- .../golang.org/x/sys/unix/ztypes_linux_riscv64.go | 60 +- vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go | 60 +- .../golang.org/x/sys/unix/ztypes_linux_sparc64.go | 60 +- vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go | 32 + .../golang.org/x/sys/unix/ztypes_netbsd_amd64.go | 33 + vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go | 32 + .../golang.org/x/sys/unix/ztypes_netbsd_arm64.go | 33 + .../golang.org/x/sys/windows/security_windows.go | 4 +- vendor/golang.org/x/sys/windows/syscall_windows.go | 77 +- vendor/golang.org/x/sys/windows/types_windows.go | 33 + .../golang.org/x/sys/windows/zsyscall_windows.go | 87 + .../x/text/internal/language/compact/gen.go | 64 - .../x/text/internal/language/compact/gen_index.go | 113 - .../text/internal/language/compact/gen_parents.go | 54 - vendor/golang.org/x/text/internal/language/gen.go | 1520 ------ .../x/text/internal/language/gen_common.go | 20 - vendor/golang.org/x/text/language/gen.go | 305 -- .../golang.org/x/text/unicode/norm/maketables.go | 986 ---- vendor/golang.org/x/text/unicode/norm/triegen.go | 117 - vendor/gopkg.in/ini.v1/.gitignore | 6 + vendor/gopkg.in/ini.v1/LICENSE | 191 + vendor/gopkg.in/ini.v1/Makefile | 15 + vendor/gopkg.in/ini.v1/README.md | 39 + vendor/gopkg.in/ini.v1/data_source.go | 74 + vendor/gopkg.in/ini.v1/deprecated.go | 25 + vendor/gopkg.in/ini.v1/error.go | 34 + vendor/gopkg.in/ini.v1/file.go | 418 ++ vendor/gopkg.in/ini.v1/helper.go | 24 + vendor/gopkg.in/ini.v1/ini.go | 166 + vendor/gopkg.in/ini.v1/key.go | 801 +++ vendor/gopkg.in/ini.v1/parser.go | 526 ++ vendor/gopkg.in/ini.v1/section.go | 256 + vendor/gopkg.in/ini.v1/struct.go | 603 +++ vendor/gopkg.in/yaml.v2/scannerc.go | 76 +- vendor/gopkg.in/yaml.v2/yaml.go | 2 +- vendor/modules.txt | 102 +- 189 files changed, 45342 insertions(+), 45075 deletions(-) create mode 100644 vendor/github.com/integrii/flaggy/parsedValue.go delete mode 100644 vendor/github.com/jesseduffield/pty/types.go delete mode 100644 vendor/github.com/jesseduffield/pty/types_dragonfly.go delete mode 100644 vendor/github.com/jesseduffield/pty/types_freebsd.go delete mode 100644 vendor/github.com/jesseduffield/pty/types_openbsd.go delete mode 100644 vendor/github.com/jesseduffield/termbox-go/syscalls.go create mode 100644 vendor/github.com/konsorten/go-windows-terminal-sequences/sequences_dummy.go create mode 100644 vendor/github.com/pelletier/go-toml/CONTRIBUTING.md create mode 100644 vendor/github.com/pelletier/go-toml/Dockerfile create mode 100644 vendor/github.com/pelletier/go-toml/PULL_REQUEST_TEMPLATE.md create mode 100644 vendor/github.com/pelletier/go-toml/azure-pipelines.yml create mode 100644 vendor/github.com/pelletier/go-toml/fuzzit.sh create mode 100644 vendor/github.com/pelletier/go-toml/go.mod create mode 100644 vendor/github.com/pelletier/go-toml/go.sum create mode 100644 vendor/github.com/pelletier/go-toml/localtime.go create mode 100644 vendor/github.com/pelletier/go-toml/marshal_OrderPreserve_test.toml delete mode 100644 vendor/github.com/pelletier/go-toml/test.sh create mode 100644 vendor/github.com/spf13/afero/go.sum create mode 100644 vendor/github.com/spf13/pflag/float32_slice.go create mode 100644 vendor/github.com/spf13/pflag/float64_slice.go create mode 100644 vendor/github.com/spf13/pflag/go.mod create mode 100644 vendor/github.com/spf13/pflag/go.sum create mode 100644 vendor/github.com/spf13/pflag/int32_slice.go create mode 100644 vendor/github.com/spf13/pflag/int64_slice.go create mode 100644 vendor/github.com/spf13/pflag/string_to_int64.go create mode 100644 vendor/github.com/spf13/viper/Makefile create mode 100644 vendor/golang.org/x/sys/cpu/cpu_arm64.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_arm64.s create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo.c delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c create mode 100644 vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go create mode 100644 vendor/golang.org/x/sys/cpu/cpu_riscv64.go create mode 100644 vendor/golang.org/x/sys/cpu/hwcap_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/mkasm_darwin.go delete mode 100644 vendor/golang.org/x/sys/unix/mkpost.go delete mode 100644 vendor/golang.org/x/sys/unix/mksyscall.go delete mode 100644 vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go delete mode 100644 vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go delete mode 100644 vendor/golang.org/x/sys/unix/mksyscall_solaris.go delete mode 100644 vendor/golang.org/x/sys/unix/mksysctl_openbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/mksysnum.go delete mode 100644 vendor/golang.org/x/sys/unix/types_aix.go delete mode 100644 vendor/golang.org/x/sys/unix/types_darwin.go delete mode 100644 vendor/golang.org/x/sys/unix/types_dragonfly.go delete mode 100644 vendor/golang.org/x/sys/unix/types_freebsd.go delete mode 100644 vendor/golang.org/x/sys/unix/types_netbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/types_openbsd.go delete mode 100644 vendor/golang.org/x/sys/unix/types_solaris.go delete mode 100644 vendor/golang.org/x/sys/unix/zptrace386_linux.go create mode 100644 vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go create mode 100644 vendor/golang.org/x/sys/unix/zptrace_linux_arm64.go create mode 100644 vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go create mode 100644 vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go create mode 100644 vendor/golang.org/x/sys/unix/zptrace_x86_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zptracearm_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zptracemips_linux.go delete mode 100644 vendor/golang.org/x/sys/unix/zptracemipsle_linux.go delete mode 100644 vendor/golang.org/x/text/internal/language/compact/gen.go delete mode 100644 vendor/golang.org/x/text/internal/language/compact/gen_index.go delete mode 100644 vendor/golang.org/x/text/internal/language/compact/gen_parents.go delete mode 100644 vendor/golang.org/x/text/internal/language/gen.go delete mode 100644 vendor/golang.org/x/text/internal/language/gen_common.go delete mode 100644 vendor/golang.org/x/text/language/gen.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/maketables.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/triegen.go create mode 100644 vendor/gopkg.in/ini.v1/.gitignore create mode 100644 vendor/gopkg.in/ini.v1/LICENSE create mode 100644 vendor/gopkg.in/ini.v1/Makefile create mode 100644 vendor/gopkg.in/ini.v1/README.md create mode 100644 vendor/gopkg.in/ini.v1/data_source.go create mode 100644 vendor/gopkg.in/ini.v1/deprecated.go create mode 100644 vendor/gopkg.in/ini.v1/error.go create mode 100644 vendor/gopkg.in/ini.v1/file.go create mode 100644 vendor/gopkg.in/ini.v1/helper.go create mode 100644 vendor/gopkg.in/ini.v1/ini.go create mode 100644 vendor/gopkg.in/ini.v1/key.go create mode 100644 vendor/gopkg.in/ini.v1/parser.go create mode 100644 vendor/gopkg.in/ini.v1/section.go create mode 100644 vendor/gopkg.in/ini.v1/struct.go (limited to 'vendor') diff --git a/vendor/github.com/integrii/flaggy/.gitignore b/vendor/github.com/integrii/flaggy/.gitignore index a1338d685..f46854f39 100644 --- a/vendor/github.com/integrii/flaggy/.gitignore +++ b/vendor/github.com/integrii/flaggy/.gitignore @@ -12,3 +12,5 @@ # Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 .glide/ + +.idea/ diff --git a/vendor/github.com/integrii/flaggy/README.md b/vendor/github.com/integrii/flaggy/README.md index dffcf99cf..740811fc7 100644 --- a/vendor/github.com/integrii/flaggy/README.md +++ b/vendor/github.com/integrii/flaggy/README.md @@ -172,41 +172,57 @@ Other more specific types can also be used as flag types. They will be automati - time.Duration - []time.Duration -# Recommended Program Structure +# An Example Program -Best practice when using flaggy includes setting your program's name, description, and version (at build time). +Best practice when using flaggy includes setting your program's name, description, and version (at build time) as shown in this example program. ```go package main import "github.com/integrii/flaggy" -// make a variable for the version which will be set at build time +// Make a variable for the version which will be set at build time. var version = "unknown" -// keep subcommands as globals so you can easily check if they were used later on +// Keep subcommands as globals so you can easily check if they were used later on. var mySubcommand *flaggy.Subcommand +// Setup the variables you want your incoming flags to set. +var testVar string + +// If you would like an environment variable as the default for a value, just populate the flag +// with the value of the environment by default. If the flag corresponding to this value is not +// used, then it will not be changed. +var myVar = os.Getenv("MY_VAR") + + func init() { // Set your program's name and description. These appear in help output. flaggy.SetName("Test Program") flaggy.SetDescription("A little example program") - // you can disable various things by changing bools on the default parser - // (or your own parser if you have created one) + // You can disable various things by changing bools on the default parser + // (or your own parser if you have created one). flaggy.DefaultParser.ShowHelpOnUnexpected = false - // you can set a help prepend or append on the default parser + // You can set a help prepend or append on the default parser. flaggy.DefaultParser.AdditionalHelpPrepend = "http://github.com/integrii/flaggy" + + // Add a flag to the main program (this will be available in all subcommands as well). + flaggy.String(&testVar, "tv", "testVariable", "A variable just for testing things!") - // create any subcommands and set their parameters + // Create any subcommands and set their parameters. mySubcommand = flaggy.NewSubcommand("mySubcommand") mySubcommand.Description = "My great subcommand!" + + // Add a flag to the subcommand. + mySubcommand.String(&myVar, "mv", "myVariable", "A variable just for me!") - // set the version and parse all inputs into variables + // Set the version and parse all inputs into variables. flaggy.SetVersion(version) flaggy.Parse() } + func main(){ if mySubcommand.Used { ... diff --git a/vendor/github.com/integrii/flaggy/argumentParser.go b/vendor/github.com/integrii/flaggy/argumentParser.go index 089f2c5ce..34d00f960 100644 --- a/vendor/github.com/integrii/flaggy/argumentParser.go +++ b/vendor/github.com/integrii/flaggy/argumentParser.go @@ -5,22 +5,20 @@ package flaggy // The return values represent the key being set, and any errors // returned when setting the key, such as failures to convert the string // into the appropriate flag value. We stop assigning values as soon -// as we find a parser that accepts it. +// as we find a any parser that accepts it. func setValueForParsers(key string, value string, parsers ...ArgumentParser) (bool, error) { - var valueWasSet bool - for _, p := range parsers { valueWasSet, err := p.SetValueForKey(key, value) if err != nil { return valueWasSet, err } if valueWasSet { - break + return true, nil } } - return valueWasSet, nil + return false, nil } // ArgumentParser represents a parser or subcommand diff --git a/vendor/github.com/integrii/flaggy/main.go b/vendor/github.com/integrii/flaggy/main.go index b44cd9155..b242cb61d 100644 --- a/vendor/github.com/integrii/flaggy/main.go +++ b/vendor/github.com/integrii/flaggy/main.go @@ -327,6 +327,18 @@ func exitOrPanic(code int) { os.Exit(code) } +// ShowHelpOnUnexpectedEnable enables the ShowHelpOnUnexpected behavior on the +// default parser. This causes unknown inputs to error out. +func ShowHelpOnUnexpectedEnable() { + DefaultParser.ShowHelpOnUnexpected = true +} + +// ShowHelpOnUnexpectedDisable disables the ShowHelpOnUnexpected behavior on the +// default parser. This causes unknown inputs to error out. +func ShowHelpOnUnexpectedDisable() { + DefaultParser.ShowHelpOnUnexpected = false +} + // AddPositionalValue adds a positional value to the main parser at the global // context func AddPositionalValue(assignmentVar *string, name string, relativePosition int, required bool, description string) { diff --git a/vendor/github.com/integrii/flaggy/parsedValue.go b/vendor/github.com/integrii/flaggy/parsedValue.go new file mode 100644 index 000000000..04ada324a --- /dev/null +++ b/vendor/github.com/integrii/flaggy/parsedValue.go @@ -0,0 +1,23 @@ +package flaggy + +// parsedValue represents a flag or subcommand that was parsed. Primairily used +// to account for all parsed values in order to determine if unknown values were +// passed to the root parser after all subcommands have been parsed. +type parsedValue struct { + Key string + Value string + IsPositional bool // indicates that this value was positional and not a key/value +} + +// newParsedValue creates and returns a new parsedValue struct with the +// supplied values set +func newParsedValue(key string, value string, isPositional bool) parsedValue { + if len(key) == 0 && len(value) == 0 { + panic("cant add parsed value with no key or value") + } + return parsedValue{ + Key: key, + Value: value, + IsPositional: isPositional, + } +} diff --git a/vendor/github.com/integrii/flaggy/parser.go b/vendor/github.com/integrii/flaggy/parser.go index 066393266..41ab76e60 100644 --- a/vendor/github.com/integrii/flaggy/parser.go +++ b/vendor/github.com/integrii/flaggy/parser.go @@ -4,18 +4,20 @@ import ( "errors" "fmt" "os" + "strconv" "text/template" ) -// Parser represents the set of vars and subcommands we are expecting -// from our input args, and the parser than handles them all. +// Parser represents the set of flags and subcommands we are expecting +// from our input arguments. Parser is the top level struct responsible for +// parsing an entire set of subcommands and flags. type Parser struct { Subcommand Version string // the optional version of the parser. ShowHelpWithHFlag bool // display help when -h or --help passed ShowVersionWithVersionFlag bool // display the version when --version passed - ShowHelpOnUnexpected bool // display help when an unexpected flag is passed + ShowHelpOnUnexpected bool // display help when an unexpected flag or subcommand is passed TrailingArguments []string // everything after a -- is placed here HelpTemplate *template.Template // template for Help output trailingArgumentsExtracted bool // indicates that trailing args have been parsed and should not be appended again @@ -46,8 +48,89 @@ func (p *Parser) ParseArgs(args []string) error { return errors.New("Parser.Parse() called twice on parser with name: " + " " + p.Name + " " + p.ShortName) } p.parsed = true - // debugPrint("Kicking off parsing with args:", args) - return p.parse(p, args, 0) + + debugPrint("Kicking off parsing with args:", args) + err := p.parse(p, args, 0) + if err != nil { + return err + } + + // if we are set to crash on unexpected args, look for those here TODO + if p.ShowHelpOnUnexpected { + parsedValues := p.findAllParsedValues() + debugPrint("parsedValues:", parsedValues) + argsNotParsed := findArgsNotInParsedValues(args, parsedValues) + if len(argsNotParsed) > 0 { + // flatten out unused args for our error message + var argsNotParsedFlat string + for _, a := range argsNotParsed { + argsNotParsedFlat = argsNotParsedFlat + " " + a + } + p.ShowHelpAndExit("Unknown arguments supplied: " + argsNotParsedFlat) + } + } + + return nil +} + +// findArgsNotInParsedValues finds arguments not used in parsed values. The +// incoming args should be in the order supplied by the user and should not +// include the invoked binary, which is normally the first thing in os.Args. +func findArgsNotInParsedValues(args []string, parsedValues []parsedValue) []string { + var argsNotUsed []string + var skipNext bool + for _, a := range args { + + // if the final argument (--) is seen, then we stop checking because all + // further values are trailing arguments. + if determineArgType(a) == argIsFinal { + return argsNotUsed + } + + // allow for skipping the next arg when needed + if skipNext { + skipNext = false + continue + } + + // strip flag slashes from incoming arguments so they match up with the + // keys from parsedValues. + arg := parseFlagToName(a) + + // indicates that we found this arg used in one of the parsed values. Used + // to indicate which values should be added to argsNotUsed. + var foundArgUsed bool + + // search all args for a corresponding parsed value + for _, pv := range parsedValues { + // this argumenet was a key + // debugPrint(pv.Key, "==", arg) + debugPrint(pv.Key + "==" + arg + " || (" + strconv.FormatBool(pv.IsPositional) + " && " + pv.Value + " == " + arg + ")") + if pv.Key == arg || (pv.IsPositional && pv.Value == arg) { + debugPrint("Found matching parsed arg for " + pv.Key) + foundArgUsed = true // the arg was used in this parsedValues set + // if the value is not a positional value and the parsed value had a + // value that was not blank, we skip the next value in the argument list + if !pv.IsPositional && len(pv.Value) > 0 { + skipNext = true + break + } + } + // this prevents excessive parsed values from being checked after we find + // the arg used for the first time + if foundArgUsed { + break + } + } + + // if the arg was not used in any parsed values, then we add it to the slice + // of arguments not used + if !foundArgUsed { + argsNotUsed = append(argsNotUsed, arg) + } + } + + return argsNotUsed } // ShowVersionAndExit shows the version of this parser @@ -105,7 +188,8 @@ func (p *Parser) ShowHelpWithMessage(message string) { } } -// Disable show version with --version. It is enabled by default. +// DisableShowVersionWithVersion disables the showing of version information +// with --version. It is enabled by default. func (p *Parser) DisableShowVersionWithVersion() { p.ShowVersionWithVersionFlag = false } diff --git a/vendor/github.com/integrii/flaggy/subCommand.go b/vendor/github.com/integrii/flaggy/subCommand.go index c0c13073d..7f99e3e8a 100644 --- a/vendor/github.com/integrii/flaggy/subCommand.go +++ b/vendor/github.com/integrii/flaggy/subCommand.go @@ -23,15 +23,20 @@ type Subcommand struct { Subcommands []*Subcommand Flags []*Flag PositionalFlags []*PositionalValue - AdditionalHelpPrepend string // additional prepended message when Help is displayed - AdditionalHelpAppend string // additional appended message when Help is displayed - Used bool // indicates this subcommand was found and parsed - Hidden bool // indicates this subcommand should be hidden from help + ParsedValues []parsedValue // a list of values and positionals parsed + AdditionalHelpPrepend string // additional prepended message when Help is displayed + AdditionalHelpAppend string // additional appended message when Help is displayed + Used bool // indicates this subcommand was found and parsed + Hidden bool // indicates this subcommand should be hidden from help } // NewSubcommand creates a new subcommand that can have flags or PositionalFlags // added to it. The position starts with 1, not 0 func NewSubcommand(name string) *Subcommand { + if len(name) == 0 { + fmt.Fprintln(os.Stderr, "Error creating subcommand (NewSubcommand()). No subcommand name was specified.") + exitOrPanic(2) + } newSC := &Subcommand{ Name: name, } @@ -39,10 +44,11 @@ func NewSubcommand(name string) *Subcommand { } // parseAllFlagsFromArgs parses the non-positional flags such as -f or -v=value -// out of the supplied args and returns the positional items in order. +// out of the supplied args and returns the resulting positional items in order, +// all the flag names found (without values), a bool to indicate if help was +// requested, and any errors found during parsing func (sc *Subcommand) parseAllFlagsFromArgs(p *Parser, args []string) ([]string, bool, error) { - var err error var positionalOnlyArguments []string var helpRequested bool // indicates the user has supplied -h and we // should render help if we are the last subcommand @@ -58,7 +64,7 @@ func (sc *Subcommand) parseAllFlagsFromArgs(p *Parser, args []string) ([]string, // find all the normal flags (not positional) and parse them out for i, a := range args { - debugPrint("parsing arg", 1, a) + debugPrint("parsing arg:", a) // evaluate if there is a following arg to avoid panics var nextArgExists bool @@ -121,62 +127,107 @@ func (sc *Subcommand) parseAllFlagsFromArgs(p *Parser, args []string) ([]string, // this positional argument into a slice of their own, so that // we can determine if its a subcommand or positional value later positionalOnlyArguments = append(positionalOnlyArguments, a) - case argIsFlagWithSpace: + // track this as a parsed value with the subcommand + sc.addParsedPositionalValue(a) + case argIsFlagWithSpace: // a flag with a space. ex) -k v or --key value a = parseFlagToName(a) + // debugPrint("Arg", i, "is flag with space:", a) // parse next arg as value to this flag and apply to subcommand flags // if the flag is a bool flag, then we check for a following positional // and skip it if necessary if flagIsBool(sc, p, a) { debugPrint(sc.Name, "bool flag", a, "next var is:", nextArg) - _, err = setValueForParsers(a, "true", p, sc) + // set the value in this subcommand and its root parser + valueSet, err := setValueForParsers(a, "true", p, sc) // if an error occurs, just return it and quit parsing if err != nil { return []string{}, false, err } - // by default, we just assign the next argument to the value and continue + + // log all values parsed by this subcommand. We leave the value blank + // because the bool value had no explicit true or false supplied + if valueSet { + sc.addParsedFlag(a, "") + } + + // we've found and set a standalone bool flag, so we move on to the next + // argument in the list of arguments continue } skipNext = true - debugPrint(sc.Name, "NOT bool flag", a) + // debugPrint(sc.Name, "NOT bool flag", a) // if the next arg was not found, then show a Help message if !nextArgExists { p.ShowHelpWithMessage("Expected a following arg for flag " + a + ", but it did not exist.") exitOrPanic(2) } - _, err = setValueForParsers(a, nextArg, p, sc) + valueSet, err := setValueForParsers(a, nextArg, p, sc) if err != nil { return []string{}, false, err } - case argIsFlagWithValue: + + // log all parsed values in the subcommand + if valueSet { + sc.addParsedFlag(a, nextArg) + } + case argIsFlagWithValue: // a flag with an equals sign. ex) -k=v or --key=value // debugPrint("Arg", i, "is flag with value:", a) a = parseFlagToName(a) + // parse flag into key and value and apply to subcommand flags key, val := parseArgWithValue(a) - _, err = setValueForParsers(key, val, p, sc) + + // set the value in this subcommand and its root parser + valueSet, err := setValueForParsers(key, val, p, sc) if err != nil { return []string{}, false, err } - // if this flag type was found and not set, and the parser is set to show - // Help when an unknown flag is found, then show Help and exit. - } + // log all values parsed by the subcommand + if valueSet { + sc.addParsedFlag(a, val) + } + } } return positionalOnlyArguments, helpRequested, nil } -// Parse causes the argument parser to parse based on the supplied []string. -// depth specifies the non-flag subcommand positional depth +// findAllParsedValues finds all values parsed by all subcommands and this +// subcommand and its child subcommands +func (sc *Subcommand) findAllParsedValues() []parsedValue { + parsedValues := sc.ParsedValues + for _, sc := range sc.Subcommands { + // skip unused subcommands + if !sc.Used { + continue + } + parsedValues = append(parsedValues, sc.findAllParsedValues()...) + } + return parsedValues +} + +// parse causes the argument parser to parse based on the supplied []string. +// depth specifies the non-flag subcommand positional depth. A slice of flags +// and subcommands parsed is returned so that the parser can ultimately decide +// if there were any unexpected values supplied by the user func (sc *Subcommand) parse(p *Parser, args []string, depth int) error { debugPrint("- Parsing subcommand", sc.Name, "with depth of", depth, "and args", args) // if a command is parsed, its used sc.Used = true + debugPrint("used subcommand", sc.Name, sc.ShortName) + if len(sc.Name) > 0 { + sc.addParsedPositionalValue(sc.Name) + } + if len(sc.ShortName) > 0 { + sc.addParsedPositionalValue(sc.ShortName) + } // as subcommands are used, they become the context of the parser. This helps // us understand how to display help based on which subcommand is being used @@ -191,9 +242,10 @@ func (sc *Subcommand) parse(p *Parser, args []string, depth int) error { sc.ensureNoConflictWithBuiltinVersion() } - // Parse the normal flags out of the argument list and retain the positionals. - // Apply the flags to the parent parser and the current subcommand context. - // ./command -f -z subcommand someVar -b becomes ./command subcommand somevar + // Parse the normal flags out of the argument list and return the positionals + // (subcommands and positional values), along with the flags used. + // Then the flag values are applied to the parent parser and the current + // subcommand being parsed. positionalOnlyArguments, helpRequested, err := sc.parseAllFlagsFromArgs(p, args) if err != nil { return err @@ -292,7 +344,7 @@ func (sc *Subcommand) parse(p *Parser, args []string, depth int) error { } // find any positionals that were not used on subcommands that were - // found and throw help (unknown argument) + // found and throw help (unknown argument) in the global parse or subcommand for _, pv := range p.PositionalFlags { if pv.Required && !pv.Found { p.ShowHelpWithMessage("Required global positional variable " + pv.Name + " not found at position " + strconv.Itoa(pv.Position)) @@ -309,6 +361,17 @@ func (sc *Subcommand) parse(p *Parser, args []string, depth int) error { return nil } +// addParsedFlag makes it easy to append flag values parsed by the subcommand +func (sc *Subcommand) addParsedFlag(key string, value string) { + sc.ParsedValues = append(sc.ParsedValues, newParsedValue(key, value, false)) +} + +// addParsedPositionalValue makes it easy to append positionals parsed by the +// subcommand +func (sc *Subcommand) addParsedPositionalValue(value string) { + sc.ParsedValues = append(sc.ParsedValues, newParsedValue("", value, true)) +} + // FlagExists lets you know if the flag name exists as either a short or long // name in the (sub)command func (sc *Subcommand) FlagExists(name string) bool { diff --git a/vendor/github.com/jesseduffield/pty/types.go b/vendor/github.com/jesseduffield/pty/types.go deleted file mode 100644 index 5aecb6bcd..000000000 --- a/vendor/github.com/jesseduffield/pty/types.go +++ /dev/null @@ -1,10 +0,0 @@ -// +build ignore - -package pty - -import "C" - -type ( - _C_int C.int - _C_uint C.uint -) diff --git a/vendor/github.com/jesseduffield/pty/types_dragonfly.go b/vendor/github.com/jesseduffield/pty/types_dragonfly.go deleted file mode 100644 index 5c0493b85..000000000 --- a/vendor/github.com/jesseduffield/pty/types_dragonfly.go +++ /dev/null @@ -1,17 +0,0 @@ -// +build ignore - -package pty - -/* -#define _KERNEL -#include -#include -#include -*/ -import "C" - -const ( - _C_SPECNAMELEN = C.SPECNAMELEN /* max length of devicename */ -) - -type fiodgnameArg C.struct_fiodname_args diff --git a/vendor/github.com/jesseduffield/pty/types_freebsd.go b/vendor/github.com/jesseduffield/pty/types_freebsd.go deleted file mode 100644 index ce3eb9518..000000000 --- a/vendor/github.com/jesseduffield/pty/types_freebsd.go +++ /dev/null @@ -1,15 +0,0 @@ -// +build ignore - -package pty - -/* -#include -#include -*/ -import "C" - -const ( - _C_SPECNAMELEN = C.SPECNAMELEN /* max length of devicename */ -) - -type fiodgnameArg C.struct_fiodgname_arg diff --git a/vendor/github.com/jesseduffield/pty/types_openbsd.go b/vendor/github.com/jesseduffield/pty/types_openbsd.go deleted file mode 100644 index 47701b5f9..000000000 --- a/vendor/github.com/jesseduffield/pty/types_openbsd.go +++ /dev/null @@ -1,14 +0,0 @@ -// +build ignore - -package pty - -/* -#include -#include -#include -*/ -import "C" - -type ptmget C.struct_ptmget - -var ioctl_PTMGET = C.PTMGET diff --git a/vendor/github.com/jesseduffield/termbox-go/syscalls.go b/vendor/github.com/jesseduffield/termbox-go/syscalls.go deleted file mode 100644 index 4f52bb9af..000000000 --- a/vendor/github.com/jesseduffield/termbox-go/syscalls.go +++ /dev/null @@ -1,39 +0,0 @@ -// +build ignore - -package termbox - -/* -#include -#include -*/ -import "C" - -type syscall_Termios C.struct_termios - -const ( - syscall_IGNBRK = C.IGNBRK - syscall_BRKINT = C.BRKINT - syscall_PARMRK = C.PARMRK - syscall_ISTRIP = C.ISTRIP - syscall_INLCR = C.INLCR - syscall_IGNCR = C.IGNCR - syscall_ICRNL = C.ICRNL - syscall_IXON = C.IXON - syscall_OPOST = C.OPOST - syscall_ECHO = C.ECHO - syscall_ECHONL = C.ECHONL - syscall_ICANON = C.ICANON - syscall_ISIG = C.ISIG - syscall_IEXTEN = C.IEXTEN - syscall_CSIZE = C.CSIZE - syscall_PARENB = C.PARENB - syscall_CS8 = C.CS8 - syscall_VMIN = C.VMIN - syscall_VTIME = C.VTIME - - // on darwin change these to (on *bsd too?): - // C.TIOCGETA - // C.TIOCSETA - syscall_TCGETS = C.TCGETS - syscall_TCSETS = C.TCSETS -) diff --git a/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md b/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md index 949b77e30..195333e51 100644 --- a/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md +++ b/vendor/github.com/konsorten/go-windows-terminal-sequences/README.md @@ -26,6 +26,7 @@ The tool is sponsored by the [marvin + konsorten GmbH](http://www.konsorten.de). We thank all the authors who provided code to this library: * Felix Kollmann +* Nicolas Perraut ## License diff --git a/vendor/github.com/konsorten/go-windows-terminal-sequences/sequences_dummy.go b/vendor/github.com/konsorten/go-windows-terminal-sequences/sequences_dummy.go new file mode 100644 index 000000000..df61a6f2f --- /dev/null +++ b/vendor/github.com/konsorten/go-windows-terminal-sequences/sequences_dummy.go @@ -0,0 +1,11 @@ +// +build linux darwin + +package sequences + +import ( + "fmt" +) + +func EnableVirtualTerminalProcessing(stream uintptr, enable bool) error { + return fmt.Errorf("windows only package") +} diff --git a/vendor/github.com/mattn/go-isatty/go.mod b/vendor/github.com/mattn/go-isatty/go.mod index a8ddf404f..53d84a672 100644 --- a/vendor/github.com/mattn/go-isatty/go.mod +++ b/vendor/github.com/mattn/go-isatty/go.mod @@ -1,5 +1,5 @@ module github.com/mattn/go-isatty -require golang.org/x/sys v0.0.0-20191008105621-543471e840be +go 1.12 -go 1.14 +require golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 diff --git a/vendor/github.com/mattn/go-isatty/go.sum b/vendor/github.com/mattn/go-isatty/go.sum index c141fc53a..5e0752bdf 100644 --- a/vendor/github.com/mattn/go-isatty/go.sum +++ b/vendor/github.com/mattn/go-isatty/go.sum @@ -1,4 +1,2 @@ -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be h1:QAcqgptGM8IQBC9K/RC4o+O9YmqEm0diQn9QmZw/0mU= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/vendor/github.com/mattn/go-isatty/isatty_plan9.go b/vendor/github.com/mattn/go-isatty/isatty_plan9.go index bc0a70920..c5b6e0c08 100644 --- a/vendor/github.com/mattn/go-isatty/isatty_plan9.go +++ b/vendor/github.com/mattn/go-isatty/isatty_plan9.go @@ -8,7 +8,7 @@ import ( // IsTerminal returns true if the given file descriptor is a terminal. func IsTerminal(fd uintptr) bool { - path, err := syscall.Fd2path(fd) + path, err := syscall.Fd2path(int(fd)) if err != nil { return false } diff --git a/vendor/github.com/mattn/go-runewidth/runewidth.go b/vendor/github.com/mattn/go-runewidth/runewidth.go index a72afbc75..8d64da077 100644 --- a/vendor/github.com/mattn/go-runewidth/runewidth.go +++ b/vendor/github.com/mattn/go-runewidth/runewidth.go @@ -102,11 +102,9 @@ func NewCondition() *Condition { // See http://www.unicode.org/reports/tr11/ func (c *Condition) RuneWidth(r rune) int { switch { - case r < 0 || r > 0x10FFFF || - inTables(r, nonprint, combining, notassigned): + case r < 0 || r > 0x10FFFF || inTables(r, nonprint, combining, notassigned): return 0 - case (c.EastAsianWidth && IsAmbiguousWidth(r)) || - inTables(r, doublewidth, emoji): + case (c.EastAsianWidth && IsAmbiguousWidth(r)) || inTables(r, doublewidth): return 2 default: return 1 @@ -128,9 +126,12 @@ func (c *Condition) stringWidthZeroJoiner(s string) (width int) { } w := c.RuneWidth(r) if r2 == 0x200D && inTables(r, emoji) && inTables(r1, emoji) { - w = 0 + if width < w { + width = w + } + } else { + width += w } - width += w r1, r2 = r2, r } return width diff --git a/vendor/github.com/pelletier/go-toml/.gitignore b/vendor/github.com/pelletier/go-toml/.gitignore index 99e38bbc5..e6ba63a5c 100644 --- a/vendor/github.com/pelletier/go-toml/.gitignore +++ b/vendor/github.com/pelletier/go-toml/.gitignore @@ -1,2 +1,5 @@ test_program/test_program_bin fuzz/ +cmd/tomll/tomll +cmd/tomljson/tomljson +cmd/tomltestgen/tomltestgen diff --git a/vendor/github.com/pelletier/go-toml/CONTRIBUTING.md b/vendor/github.com/pelletier/go-toml/CONTRIBUTING.md new file mode 100644 index 000000000..405c911c9 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/CONTRIBUTING.md @@ -0,0 +1,132 @@ +## Contributing + +Thank you for your interest in go-toml! We appreciate you considering +contributing to go-toml! + +The main goal is the project is to provide an easy-to-use TOML +implementation for Go that gets the job done and gets out of your way – +dealing with TOML is probably not the central piece of your project. + +As the single maintainer of go-toml, time is scarce. All help, big or +small, is more than welcomed! + +### Ask questions + +Any question you may have, somebody else might have it too. Always feel +free to ask them on the [issues tracker][issues-tracker]. We will try to +answer them as clearly and quickly as possible, time permitting. + +Asking questions also helps us identify areas where the documentation needs +improvement, or new features that weren't envisioned before. Sometimes, a +seemingly innocent question leads to the fix of a bug. Don't hesitate and +ask away! + +### Improve the documentation + +The best way to share your knowledge and experience with go-toml is to +improve the documentation. Fix a typo, clarify an interface, add an +example, anything goes! + +The documentation is present in the [README][readme] and thorough the +source code. On release, it gets updated on [GoDoc][godoc]. To make a +change to the documentation, create a pull request with your proposed +changes. For simple changes like that, the easiest way to go is probably +the "Fork this project and edit the file" button on Github, displayed at +the top right of the file. Unless it's a trivial change (for example a +typo), provide a little bit of context in your pull request description or +commit message. + +### Report a bug + +Found a bug! Sorry to hear that :(. Help us and other track them down and +fix by reporting it. [File a new bug report][bug-report] on the [issues +tracker][issues-tracker]. The template should provide enough guidance on +what to include. When in doubt: add more details! By reducing ambiguity and +providing more information, it decreases back and forth and saves everyone +time. + +### Code changes + +Want to contribute a patch? Very happy to hear that! + +First, some high-level rules: + +* A short proposal with some POC code is better than a lengthy piece of + text with no code. Code speaks louder than words. +* No backward-incompatible patch will be accepted unless discussed. + Sometimes it's hard, and Go's lack of versioning by default does not + help, but we try not to break people's programs unless we absolutely have + to. +* If you are writing a new feature or extending an existing one, make sure + to write some documentation. +* Bug fixes need to be accompanied with regression tests. +* New code needs to be tested. +* Your commit messages need to explain why the change is needed, even if + already included in the PR description. + +It does sound like a lot, but those best practices are here to save time +overall and continuously improve the quality of the project, which is +something everyone benefits from. + +#### Get started + +The fairly standard code contribution process looks like that: + +1. [Fork the project][fork]. +2. Make your changes, commit on any branch you like. +3. [Open up a pull request][pull-request] +4. Review, potential ask for changes. +5. Merge. You're in! + +Feel free to ask for help! You can create draft pull requests to gather +some early feedback! + +#### Run the tests + +You can run tests for go-toml using Go's test tool: `go test ./...`. +When creating a pull requests, all tests will be ran on Linux on a few Go +versions (Travis CI), and on Windows using the latest Go version +(AppVeyor). + +#### Style + +Try to look around and follow the same format and structure as the rest of +the code. We enforce using `go fmt` on the whole code base. + +--- + +### Maintainers-only + +#### Merge pull request + +Checklist: + +* Passing CI. +* Does not introduce backward-incompatible changes (unless discussed). +* Has relevant doc changes. +* Has relevant unit tests. + +1. Merge using "squash and merge". +2. Make sure to edit the commit message to keep all the useful information + nice and clean. +3. Make sure the commit title is clear and contains the PR number (#123). + +#### New release + +1. Go to [releases][releases]. Click on "X commits to master since this + release". +2. Make note of all the changes. Look for backward incompatible changes, + new features, and bug fixes. +3. Pick the new version using the above and semver. +4. Create a [new release][new-release]. +5. Follow the same format as [1.1.0][release-110]. + +[issues-tracker]: https://github.com/pelletier/go-toml/issues +[bug-report]: https://github.com/pelletier/go-toml/issues/new?template=bug_report.md +[godoc]: https://godoc.org/github.com/pelletier/go-toml +[readme]: ./README.md +[fork]: https://help.github.com/articles/fork-a-repo +[pull-request]: https://help.github.com/en/articles/creating-a-pull-request +[releases]: https://github.com/pelletier/go-toml/releases +[new-release]: https://github.com/pelletier/go-toml/releases/new +[release-110]: https://github.com/pelletier/go-toml/releases/tag/v1.1.0 diff --git a/vendor/github.com/pelletier/go-toml/Dockerfile b/vendor/github.com/pelletier/go-toml/Dockerfile new file mode 100644 index 000000000..fffdb0166 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/Dockerfile @@ -0,0 +1,11 @@ +FROM golang:1.12-alpine3.9 as builder +WORKDIR /go/src/github.com/pelletier/go-toml +COPY . . +ENV CGO_ENABLED=0 +ENV GOOS=linux +RUN go install ./... + +FROM scratch +COPY --from=builder /go/bin/tomll /usr/bin/tomll +COPY --from=builder /go/bin/tomljson /usr/bin/tomljson +COPY --from=builder /go/bin/jsontoml /usr/bin/jsontoml diff --git a/vendor/github.com/pelletier/go-toml/PULL_REQUEST_TEMPLATE.md b/vendor/github.com/pelletier/go-toml/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..041cdc4a2 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,5 @@ +**Issue:** add link to pelletier/go-toml issue here + +Explanation of what this pull request does. + +More detailed description of the decisions being made and the reasons why (if the patch is non-trivial). diff --git a/vendor/github.com/pelletier/go-toml/README.md b/vendor/github.com/pelletier/go-toml/README.md index 0d357acf3..4ef303af0 100644 --- a/vendor/github.com/pelletier/go-toml/README.md +++ b/vendor/github.com/pelletier/go-toml/README.md @@ -3,13 +3,14 @@ Go library for the [TOML](https://github.com/mojombo/toml) format. This library supports TOML version -[v0.4.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md) +[v0.5.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.5.0.md) [![GoDoc](https://godoc.org/github.com/pelletier/go-toml?status.svg)](http://godoc.org/github.com/pelletier/go-toml) [![license](https://img.shields.io/github/license/pelletier/go-toml.svg)](https://github.com/pelletier/go-toml/blob/master/LICENSE) -[![Build Status](https://travis-ci.org/pelletier/go-toml.svg?branch=master)](https://travis-ci.org/pelletier/go-toml) -[![Coverage Status](https://coveralls.io/repos/github/pelletier/go-toml/badge.svg?branch=master)](https://coveralls.io/github/pelletier/go-toml?branch=master) +[![Build Status](https://dev.azure.com/pelletierthomas/go-toml-ci/_apis/build/status/pelletier.go-toml?branchName=master)](https://dev.azure.com/pelletierthomas/go-toml-ci/_build/latest?definitionId=1&branchName=master) +[![codecov](https://codecov.io/gh/pelletier/go-toml/branch/master/graph/badge.svg)](https://codecov.io/gh/pelletier/go-toml) [![Go Report Card](https://goreportcard.com/badge/github.com/pelletier/go-toml)](https://goreportcard.com/report/github.com/pelletier/go-toml) +[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fpelletier%2Fgo-toml.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fpelletier%2Fgo-toml?ref=badge_shield) ## Features @@ -98,6 +99,30 @@ Go-toml provides two handy command line tools: go install github.com/pelletier/go-toml/cmd/tomljson tomljson --help ``` + + * `jsontoml`: Reads a JSON file and outputs a TOML representation. + + ``` + go install github.com/pelletier/go-toml/cmd/jsontoml + jsontoml --help + ``` + +### Docker image + +Those tools are also availble as a Docker image from +[dockerhub](https://hub.docker.com/r/pelletier/go-toml). For example, to +use `tomljson`: + +``` +docker run -v $PWD:/workdir pelletier/go-toml tomljson /workdir/example.toml +``` + +Only master (`latest`) and tagged versions are published to dockerhub. You +can build your own image as usual: + +``` +docker build -t go-toml . +``` ## Contribute @@ -107,12 +132,7 @@ much appreciated! ### Run tests -You have to make sure two kind of tests run: - -1. The Go unit tests -2. The TOML examples base - -You can run both of them using `./test.sh`. +`go test ./...` ### Fuzzing diff --git a/vendor/github.com/pelletier/go-toml/azure-pipelines.yml b/vendor/github.com/pelletier/go-toml/azure-pipelines.yml new file mode 100644 index 000000000..d8d7944b7 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/azure-pipelines.yml @@ -0,0 +1,167 @@ +trigger: +- master + +stages: +- stage: fuzzit + displayName: "Run Fuzzit" + dependsOn: [] + condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master')) + jobs: + - job: submit + displayName: "Submit" + pool: + vmImage: ubuntu-latest + steps: + - task: GoTool@0 + displayName: "Install Go 1.13" + inputs: + version: "1.13" + - script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/" + - script: mkdir -p ${HOME}/go/src/github.com/pelletier/go-toml + - script: cp -R . ${HOME}/go/src/github.com/pelletier/go-toml + - task: Bash@3 + inputs: + filePath: './fuzzit.sh' + env: + TYPE: fuzzing + FUZZIT_API_KEY: $(FUZZIT_API_KEY) + +- stage: run_checks + displayName: "Check" + dependsOn: [] + jobs: + - job: fmt + displayName: "fmt" + pool: + vmImage: ubuntu-latest + steps: + - task: GoTool@0 + displayName: "Install Go 1.13" + inputs: + version: "1.13" + - task: Go@0 + displayName: "go fmt ./..." + inputs: + command: 'custom' + customCommand: 'fmt' + arguments: './...' + - job: coverage + displayName: "coverage" + pool: + vmImage: ubuntu-latest + steps: + - task: GoTool@0 + displayName: "Install Go 1.13" + inputs: + version: "1.13" + - task: Go@0 + displayName: "Generate coverage" + inputs: + command: 'test' + arguments: "-race -coverprofile=coverage.txt -covermode=atomic" + - task: Bash@3 + inputs: + targetType: 'inline' + script: 'bash <(curl -s https://codecov.io/bash) -t $(CODECOV_TOKEN)' + - job: benchmark + displayName: "benchmark" + pool: + vmImage: ubuntu-latest + steps: + - task: GoTool@0 + displayName: "Install Go 1.13" + inputs: + version: "1.13" + - script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/" + - task: Bash@3 + inputs: + filePath: './benchmark.sh' + arguments: "master $(Build.Repository.Uri)" + + - job: fuzzing + displayName: "fuzzing" + pool: + vmImage: ubuntu-latest + steps: + - task: GoTool@0 + displayName: "Install Go 1.13" + inputs: + version: "1.13" + - script: echo "##vso[task.setvariable variable=PATH]${PATH}:/home/vsts/go/bin/" + - script: mkdir -p ${HOME}/go/src/github.com/pelletier/go-toml + - script: cp -R . ${HOME}/go/src/github.com/pelletier/go-toml + - task: Bash@3 + inputs: + filePath: './fuzzit.sh' + env: + TYPE: local-regression + + - job: go_unit_tests + displayName: "unit tests" + strategy: + matrix: + linux 1.13: + goVersion: '1.13' + imageName: 'ubuntu-latest' + mac 1.13: + goVersion: '1.13' + imageName: 'macos-10.13' + windows 1.13: + goVersion: '1.13' + imageName: 'vs2017-win2016' + linux 1.12: + goVersion: '1.12' + imageName: 'ubuntu-latest' + mac 1.12: + goVersion: '1.12' + imageName: 'macos-10.13' + windows 1.12: + goVersion: '1.12' + imageName: 'vs2017-win2016' + pool: + vmImage: $(imageName) + steps: + - task: GoTool@0 + displayName: "Install Go $(goVersion)" + inputs: + version: $(goVersion) + - task: Go@0 + displayName: "go test ./..." + inputs: + command: 'test' + arguments: './...' + +- stage: build_docker_image + displayName: "Build Docker image" + dependsOn: run_checks + jobs: + - job: build + displayName: "Build" + pool: + vmImage: ubuntu-latest + steps: + - task: Docker@2 + inputs: + command: 'build' + Dockerfile: 'Dockerfile' + buildContext: '.' + addPipelineData: false + +- stage: publish_docker_image + displayName: "Publish Docker image" + dependsOn: build_docker_image + condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master')) + jobs: + - job: publish + displayName: "Publish" + pool: + vmImage: ubuntu-latest + steps: + - task: Docker@2 + inputs: + containerRegistry: 'DockerHub' + repository: 'pelletier/go-toml' + command: 'buildAndPush' + Dockerfile: 'Dockerfile' + buildContext: '.' + tags: 'latest' \ No newline at end of file diff --git a/vendor/github.com/pelletier/go-toml/benchmark.sh b/vendor/github.com/pelletier/go-toml/benchmark.sh index 8b8bb528e..7914fff49 100644 --- a/vendor/github.com/pelletier/go-toml/benchmark.sh +++ b/vendor/github.com/pelletier/go-toml/benchmark.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -e +set -ex reference_ref=${1:-master} reference_git=${2:-.} @@ -8,7 +8,6 @@ reference_git=${2:-.} if ! `hash benchstat 2>/dev/null`; then echo "Installing benchstat" go get golang.org/x/perf/cmd/benchstat - go install golang.org/x/perf/cmd/benchstat fi tempdir=`mktemp -d /tmp/go-toml-benchmark-XXXXXX` @@ -29,4 +28,4 @@ go test -bench=. -benchmem | tee ${local_benchmark} echo "" echo "=== diff" -benchstat -delta-test=none ${ref_benchmark} ${local_benchmark} \ No newline at end of file +benchstat -delta-test=none ${ref_benchmark} ${local_benchmark} diff --git a/vendor/github.com/pelletier/go-toml/doc.go b/vendor/github.com/pelletier/go-toml/doc.go index d5fd98c02..a1406a32b 100644 --- a/vendor/github.com/pelletier/go-toml/doc.go +++ b/vendor/github.com/pelletier/go-toml/doc.go @@ -1,7 +1,7 @@ // Package toml is a TOML parser and manipulation library. // // This version supports the specification as described in -// https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md +// https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.5.0.md // // Marshaling // diff --git a/vendor/github.com/pelletier/go-toml/fuzzit.sh b/vendor/github.com/pelletier/go-toml/fuzzit.sh new file mode 100644 index 000000000..b575a6081 --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/fuzzit.sh @@ -0,0 +1,26 @@ +#!/bin/bash +set -xe + +# go-fuzz doesn't support modules yet, so ensure we do everything +# in the old style GOPATH way +export GO111MODULE="off" + +# install go-fuzz +go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build + +# target name can only contain lower-case letters (a-z), digits (0-9) and a dash (-) +# to add another target, make sure to create it with `fuzzit create target` +# before using `fuzzit create job` +TARGET=toml-fuzzer + +go-fuzz-build -libfuzzer -o ${TARGET}.a github.com/pelletier/go-toml +clang -fsanitize=fuzzer ${TARGET}.a -o ${TARGET} + +# install fuzzit for talking to fuzzit.dev service +# or latest version: +# https://github.com/fuzzitdev/fuzzit/releases/latest/download/fuzzit_Linux_x86_64 +wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.52/fuzzit_Linux_x86_64 +chmod a+x fuzzit + +# TODO: change kkowalczyk to go-toml and create toml-fuzzer target there +./fuzzit create job --type $TYPE go-toml/${TARGET} ${TARGET} diff --git a/vendor/github.com/pelletier/go-toml/go.mod b/vendor/github.com/pelletier/go-toml/go.mod new file mode 100644 index 000000000..a17e9331f --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/go.mod @@ -0,0 +1,9 @@ +module github.com/pelletier/go-toml + +go 1.12 + +require ( + github.com/BurntSushi/toml v0.3.1 + github.com/davecgh/go-spew v1.1.1 + gopkg.in/yaml.v2 v2.2.4 +) diff --git a/vendor/github.com/pelletier/go-toml/go.sum b/vendor/github.com/pelletier/go-toml/go.sum new file mode 100644 index 000000000..1cd2613dd --- /dev/null +++ b/vendor/github.com/pelletier/go-toml/go.sum @@ -0,0 +1,11 @@ +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3 h1:fvjTMHxHEw/mxHbtzPi3JCcKXQRAnQTBRo6YCJSVHKI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/pelletier/go-toml/keysparsing.go b/vendor/github.com/pelletier/go-toml/keysparsing.go index 284db6467..e923bc4f9 100644 --- a/vendor/github.com/pelletier/go-toml/keysparsing.go +++ b/vendor/github.com/pelletier/go-toml/keysparsing.go @@ -3,79 +3,107 @@ package toml import ( - "bytes" "errors" "fmt" "unicode" ) // Convert the bare key group string to an array. -// The input supports double quotation to allow "." inside the key name, +// The input supports double quotation and single quotation, // but escape sequences are not supported. Lexers must unescape them beforehand. func parseKey(key string) ([]string, error) { - groups := []string{} - var buffer bytes.Buffer - inQuotes := false - wasInQuotes := false - ignoreSpace := true - expectDot := false + runes := []rune(key) + var groups []string - for _, char := range key { - if ignoreSpace { - if char == ' ' { - continue - } - ignoreSpace = false + if len(key) == 0 { + return nil, errors.New("empty key") + } + + idx := 0 + for idx < len(runes) { + for ; idx < len(runes) && isSpace(runes[idx]); idx++ { + // skip leading whitespace } - switch char { - case '"': - if inQuotes { - groups = append(groups, buffer.String()) - buffer.Reset() - wasInQuotes = true - } - inQuotes = !inQuotes - expectDot = false - case '.': - if inQuotes { - buffer.WriteRune(char) - } else { - if !wasInQuotes { - if buffer.Len() == 0 { - return nil, errors.New("empty table key") + if idx >= len(runes) { + break + } + r := runes[idx] + if isValidBareChar(r) { + // parse bare key + startIdx := idx + endIdx := -1 + idx++ + for idx < len(runes) { + r = runes[idx] + if isValidBareChar(r) { + idx++ + } else if r == '.' { + endIdx = idx + break + } else if isSpace(r) { + endIdx = idx