diff options
| author | 2024-03-04 09:42:11 +0000 | |
|---|---|---|
| committer | 2024-03-04 09:42:11 +0000 | |
| commit | adb4cdcf6c9eacd369eaaf5b21774b198d57c040 (patch) | |
| tree | a4f9c8fe2ce147fa952bcb795690afb9bb2affcb /vendor/modernc.org/opt | |
| parent | [bugfix] update postgresqlstmt to correctly use postgres err hook (#2711) (diff) | |
| download | gotosocial-adb4cdcf6c9eacd369eaaf5b21774b198d57c040.tar.xz | |
[chore]: Bump modernc.org/sqlite from 1.28.0 to 1.29.2 (#2718)
Diffstat (limited to 'vendor/modernc.org/opt')
| -rw-r--r-- | vendor/modernc.org/opt/AUTHORS | 11 | ||||
| -rw-r--r-- | vendor/modernc.org/opt/CONTRIBUTORS | 9 | ||||
| -rw-r--r-- | vendor/modernc.org/opt/LICENSE | 27 | ||||
| -rw-r--r-- | vendor/modernc.org/opt/Makefile | 18 | ||||
| -rw-r--r-- | vendor/modernc.org/opt/README.md | 11 | ||||
| -rw-r--r-- | vendor/modernc.org/opt/opt.go | 155 | ||||
| -rw-r--r-- | vendor/modernc.org/opt/unconvert.sh | 4 |
7 files changed, 0 insertions, 235 deletions
diff --git a/vendor/modernc.org/opt/AUTHORS b/vendor/modernc.org/opt/AUTHORS deleted file mode 100644 index 0078f5f5b..000000000 --- a/vendor/modernc.org/opt/AUTHORS +++ /dev/null @@ -1,11 +0,0 @@ -# This file lists authors for copyright purposes. This file is distinct from -# the CONTRIBUTORS files. See the latter for an explanation. -# -# Names should be added to this file as: -# Name or Organization <email address> -# -# The email address is not required for organizations. -# -# Please keep the list sorted. - -Jan Mercl <0xjnml@gmail.com> diff --git a/vendor/modernc.org/opt/CONTRIBUTORS b/vendor/modernc.org/opt/CONTRIBUTORS deleted file mode 100644 index 5e86f0607..000000000 --- a/vendor/modernc.org/opt/CONTRIBUTORS +++ /dev/null @@ -1,9 +0,0 @@ -# This file lists people who contributed code to this repository. The AUTHORS -# file lists the copyright holders; this file lists people. -# -# Names should be added to this file like so: -# Name <email address> -# -# Please keep the list sorted. - -Jan Mercl <0xjnml@gmail.com> diff --git a/vendor/modernc.org/opt/LICENSE b/vendor/modernc.org/opt/LICENSE deleted file mode 100644 index 11a2e914c..000000000 --- a/vendor/modernc.org/opt/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2019 The Opt Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the names of the authors nor the names of the -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/modernc.org/opt/Makefile b/vendor/modernc.org/opt/Makefile deleted file mode 100644 index 8fc8fb409..000000000 --- a/vendor/modernc.org/opt/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2022 The Opt Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -.PHONY: clean edit editor - -clean: - rm -f log-* cpu.test mem.test *.out - go clean - -edit: - @touch log - @if [ -f "Session.vim" ]; then gvim -S & else gvim -p Makefile *.go & fi - -editor: - gofmt -l -s -w *.go - go test -o /dev/null -c - go install 2>&1 | tee log-editor diff --git a/vendor/modernc.org/opt/README.md b/vendor/modernc.org/opt/README.md deleted file mode 100644 index f04870fbf..000000000 --- a/vendor/modernc.org/opt/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# opt - -Package opt implements command-line flag parsing. - -### Installation - - $ go get [-u] modernc.org/opt - -### Documentation - -[godoc.org/modernc.org/opt](http://godoc.org/modernc.org/opt) diff --git a/vendor/modernc.org/opt/opt.go b/vendor/modernc.org/opt/opt.go deleted file mode 100644 index b4bd8282b..000000000 --- a/vendor/modernc.org/opt/opt.go +++ /dev/null @@ -1,155 +0,0 @@ -// Package opt implements command-line flag parsing. -package opt // import "modernc.org/opt" - -import ( - "fmt" - "strings" -) - -type opt struct { - handler func(opt, arg string) error - name string - - arg bool // Enable argument, e.g. `-I foo` or `-I=foo` -} - -// A Set represents a set of defined options. -type Set struct { - cfg map[string]*opt - imm []*opt -} - -// NewSet returns a new, empty option set. -func NewSet() *Set { return &Set{cfg: map[string]*opt{}} } - -// Opt defines a simple option, e.g. `-f`. When the option is found during -// Parse, the handler is called with the value of the option, e.g. "-f". -func (p *Set) Opt(name string, handler func(opt string) error) { - p.cfg[name] = &opt{ - handler: func(opt, arg string) error { return handler(opt) }, - } -} - -// Arg defines a simple option with an argument, e.g. `-I foo` or `-I=foo`. -// Setting imm argument enables additionally `-Ifoo`. When the option is found -// during Parse, the handler is called with the values of the option and the -// argument, e.g. "-I" and "foo" for all of the variants. -func (p *Set) Arg(name string, imm bool, handler func(opt, arg string) error) { - switch { - case imm: - p.imm = append(p.imm, &opt{ - handler: handler, - name: name, - }) - default: - p.cfg[name] = &opt{ - arg: true, - handler: handler, - name: name, - } - } -} - -// Parse parses opts. Must be called after all options are defined. The handler -// is called for all items in opts that were not defined before using Opt or -// Arg. -// -// If any handler returns a non-nil error, Parse will stop. If the error is of -// type Skip, the error returned by Parse will contain all the unprocessed -// items of opts. -// -// The opts slice must not be modified by any handler while Parser is -// executing. -func (p *Set) Parse(opts []string, handler func(string) error) (err error) { - defer func() { - switch err.(type) { - case Skip: - err = Skip(opts) - } - }() - - for len(opts) != 0 { - opt := opts[0] - opt0 := opt - opts = opts[1:] - var arg string - out: - switch { - case strings.HasPrefix(opt, "-"): - name := opt[1:] - for _, cfg := range p.imm { - if strings.HasPrefix(name, cfg.name) { - switch { - case name == cfg.name: - if len(opts) == 0 { - return fmt.Errorf("missing argument of %s", opt) - } - - if err = cfg.handler(opt, opts[0]); err != nil { - return err - } - - opts = opts[1:] - default: - opt = opt[:len(cfg.name)+1] - val := strings.TrimPrefix(name[len(cfg.name):], "=") - if err = cfg.handler(opt, val); err != nil { - return err - } - } - break out - } - } - - if n := strings.IndexByte(opt, '='); n > 0 { - arg = opt[n+1:] - name = opt[1:n] - opt = opt[:n] - } - switch cfg := p.cfg[name]; { - case cfg == nil: - if err = handler(opt0); err != nil { - return err - } - default: - switch { - case cfg.arg: - switch { - case arg != "": - if err = cfg.handler(opt, arg); err != nil { - return err - } - default: - if len(opts) == 0 { - return fmt.Errorf("missing argument of %s", opt) - } - - if err = cfg.handler(opt, opts[0]); err != nil { - return err - } - - opts = opts[1:] - } - default: - if err = cfg.handler(opt, ""); err != nil { - return err - } - } - } - default: - if opt == "" { - break - } - - if err = handler(opt); err != nil { - return err - } - } - } - return nil -} - -// Skip is an error that contains all unprocessed items passed to Parse. -type Skip []string - -func (s Skip) Error() string { return fmt.Sprint([]string(s)) } diff --git a/vendor/modernc.org/opt/unconvert.sh b/vendor/modernc.org/opt/unconvert.sh deleted file mode 100644 index af3b87f83..000000000 --- a/vendor/modernc.org/opt/unconvert.sh +++ /dev/null @@ -1,4 +0,0 @@ -until unconvert -fastmath . &> /dev/null -do - unconvert -fastmath -apply . &> /dev/null -done |
