mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 07:33:21 +00:00
Update dependencies
This commit is contained in:
parent
0e5f662fed
commit
cae51e1478
7 changed files with 87 additions and 47 deletions
4
Gopkg.lock
generated
4
Gopkg.lock
generated
|
@ -4,7 +4,7 @@
|
|||
[[projects]]
|
||||
name = "github.com/gorilla/handlers"
|
||||
packages = ["."]
|
||||
revision = "a4d79d4487c2430a17d9dc8a1f74d1a6ed6908ca"
|
||||
revision = "a4043c62cc2329bacda331d33fc908ab11ef0ec3"
|
||||
source = "https://github.com/gorilla/handlers"
|
||||
version = "v1.2.1"
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
branch = "master"
|
||||
name = "github.com/spf13/cobra"
|
||||
packages = ["."]
|
||||
revision = "4d647c8944eb42504a714e57e97f244ed6344722"
|
||||
revision = "715f41bd7a70b5111f898b71ab484da52ee6266d"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
|
2
vendor/github.com/gorilla/handlers/.travis.yml
generated
vendored
2
vendor/github.com/gorilla/handlers/.travis.yml
generated
vendored
|
@ -7,7 +7,6 @@ matrix:
|
|||
- go: 1.5
|
||||
- go: 1.6
|
||||
- go: 1.7
|
||||
- go: 1.8
|
||||
- go: tip
|
||||
allow_failures:
|
||||
- go: tip
|
||||
|
@ -17,4 +16,3 @@ script:
|
|||
- diff -u <(echo -n) <(gofmt -d .)
|
||||
- go vet $(go list ./... | grep -v /vendor/)
|
||||
- go test -v -race ./...
|
||||
|
||||
|
|
9
vendor/github.com/spf13/cobra/cobra.go
generated
vendored
9
vendor/github.com/spf13/cobra/cobra.go
generated
vendored
|
@ -47,6 +47,15 @@ var EnablePrefixMatching = false
|
|||
// To disable sorting, set it to false.
|
||||
var EnableCommandSorting = true
|
||||
|
||||
// MousetrapHelpText enables an information splash screen on Windows
|
||||
// if the CLI is started from explorer.exe.
|
||||
// To disable the mousetrap, just set this variable to blank string ("").
|
||||
// Works only on Microsoft Windows.
|
||||
var MousetrapHelpText string = `This is a command line tool.
|
||||
|
||||
You need to open cmd.exe and run it from there.
|
||||
`
|
||||
|
||||
// AddTemplateFunc adds a template function that's available to Usage and Help
|
||||
// template generation.
|
||||
func AddTemplateFunc(name string, tmplFunc interface{}) {
|
||||
|
|
34
vendor/github.com/spf13/cobra/cobra/cmd/helpers.go
generated
vendored
34
vendor/github.com/spf13/cobra/cobra/cmd/helpers.go
generated
vendored
|
@ -45,24 +45,34 @@ func er(msg interface{}) {
|
|||
}
|
||||
|
||||
// isEmpty checks if a given path is empty.
|
||||
// Hidden files in path are ignored.
|
||||
func isEmpty(path string) bool {
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
er(err)
|
||||
}
|
||||
if fi.IsDir() {
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
er(err)
|
||||
}
|
||||
defer f.Close()
|
||||
dirs, err := f.Readdirnames(1)
|
||||
if err != nil && err != io.EOF {
|
||||
er(err)
|
||||
}
|
||||
return len(dirs) == 0
|
||||
|
||||
if !fi.IsDir() {
|
||||
return fi.Size() == 0
|
||||
}
|
||||
return fi.Size() == 0
|
||||
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
er(err)
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
names, err := f.Readdirnames(-1)
|
||||
if err != nil && err != io.EOF {
|
||||
er(err)
|
||||
}
|
||||
|
||||
for _, name := range names {
|
||||
if len(name) > 0 && name[0] != '.' {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// exists checks if a file or directory exists.
|
||||
|
|
36
vendor/github.com/spf13/cobra/command.go
generated
vendored
36
vendor/github.com/spf13/cobra/command.go
generated
vendored
|
@ -767,28 +767,28 @@ func (c *Command) InitDefaultHelpFlag() {
|
|||
// It is called automatically by executing the c or by calling help and usage.
|
||||
// If c already has help command or c has no subcommands, it will do nothing.
|
||||
func (c *Command) InitDefaultHelpCmd() {
|
||||
if c.helpCommand != nil || !c.HasSubCommands() {
|
||||
if !c.HasSubCommands() {
|
||||
return
|
||||
}
|
||||
|
||||
c.helpCommand = &Command{
|
||||
Use: "help [command]",
|
||||
Short: "Help about any command",
|
||||
Long: `Help provides help for any command in the application.
|
||||
Simply type ` + c.Name() + ` help [path to command] for full details.`,
|
||||
PersistentPreRun: func(cmd *Command, args []string) {},
|
||||
PersistentPostRun: func(cmd *Command, args []string) {},
|
||||
if c.helpCommand == nil {
|
||||
c.helpCommand = &Command{
|
||||
Use: "help [command]",
|
||||
Short: "Help about any command",
|
||||
Long: `Help provides help for any command in the application.
|
||||
Simply type ` + c.Name() + ` help [path to command] for full details.`,
|
||||
|
||||
Run: func(c *Command, args []string) {
|
||||
cmd, _, e := c.Root().Find(args)
|
||||
if cmd == nil || e != nil {
|
||||
c.Printf("Unknown help topic %#q\n", args)
|
||||
c.Root().Usage()
|
||||
} else {
|
||||
cmd.InitDefaultHelpFlag() // make possible 'help' flag to be shown
|
||||
cmd.Help()
|
||||
}
|
||||
},
|
||||
Run: func(c *Command, args []string) {
|
||||
cmd, _, e := c.Root().Find(args)
|
||||
if cmd == nil || e != nil {
|
||||
c.Printf("Unknown help topic %#q\n", args)
|
||||
c.Root().Usage()
|
||||
} else {
|
||||
cmd.InitDefaultHelpFlag() // make possible 'help' flag to be shown
|
||||
cmd.Help()
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
c.RemoveCommand(c.helpCommand)
|
||||
c.AddCommand(c.helpCommand)
|
||||
|
|
41
vendor/github.com/spf13/cobra/command_test.go
generated
vendored
41
vendor/github.com/spf13/cobra/command_test.go
generated
vendored
|
@ -120,7 +120,6 @@ func TestStripFlags(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestDisableFlagParsing(t *testing.T) {
|
||||
as := []string{"-v", "-race", "-file", "foo.go"}
|
||||
targs := []string{}
|
||||
cmdPrint := &Command{
|
||||
DisableFlagParsing: true,
|
||||
|
@ -128,14 +127,14 @@ func TestDisableFlagParsing(t *testing.T) {
|
|||
targs = args
|
||||
},
|
||||
}
|
||||
osargs := []string{"cmd"}
|
||||
os.Args = append(osargs, as...)
|
||||
args := []string{"cmd", "-v", "-race", "-file", "foo.go"}
|
||||
cmdPrint.SetArgs(args)
|
||||
err := cmdPrint.Execute()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !reflect.DeepEqual(as, targs) {
|
||||
t.Errorf("expected: %v, got: %v", as, targs)
|
||||
if !reflect.DeepEqual(args, targs) {
|
||||
t.Errorf("expected: %v, got: %v", args, targs)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,5 +315,35 @@ func TestUseDeprecatedFlags(t *testing.T) {
|
|||
if !strings.Contains(output.String(), "This flag is deprecated") {
|
||||
t.Errorf("Expected to contain deprecated message, but got %q", output.String())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TestSetHelpCommand checks, if SetHelpCommand works correctly.
|
||||
func TestSetHelpCommand(t *testing.T) {
|
||||
c := &Command{Use: "c", Run: func(*Command, []string) {}}
|
||||
output := new(bytes.Buffer)
|
||||
c.SetOutput(output)
|
||||
c.SetArgs([]string{"help"})
|
||||
|
||||
// Help will not be shown, if c has no subcommands.
|
||||
c.AddCommand(&Command{
|
||||
Use: "empty",
|
||||
Run: func(cmd *Command, args []string) {},
|
||||
})
|
||||
|
||||
correctMessage := "WORKS"
|
||||
c.SetHelpCommand(&Command{
|
||||
Use: "help [command]",
|
||||
Short: "Help about any command",
|
||||
Long: `Help provides help for any command in the application.
|
||||
Simply type ` + c.Name() + ` help [path to command] for full details.`,
|
||||
Run: func(c *Command, args []string) { c.Print(correctMessage) },
|
||||
})
|
||||
|
||||
if err := c.Execute(); err != nil {
|
||||
t.Error("Unexpected error:", err)
|
||||
}
|
||||
|
||||
if output.String() != correctMessage {
|
||||
t.Errorf("Expected to contain %q message, but got %q", correctMessage, output.String())
|
||||
}
|
||||
}
|
||||
|
|
8
vendor/github.com/spf13/cobra/command_win.go
generated
vendored
8
vendor/github.com/spf13/cobra/command_win.go
generated
vendored
|
@ -11,14 +11,8 @@ import (
|
|||
|
||||
var preExecHookFn = preExecHook
|
||||
|
||||
// enables an information splash screen on Windows if the CLI is started from explorer.exe.
|
||||
var MousetrapHelpText string = `This is a command line tool
|
||||
|
||||
You need to open cmd.exe and run it from there.
|
||||
`
|
||||
|
||||
func preExecHook(c *Command) {
|
||||
if mousetrap.StartedByExplorer() {
|
||||
if MousetrapHelpText != "" && mousetrap.StartedByExplorer() {
|
||||
c.Print(MousetrapHelpText)
|
||||
time.Sleep(5 * time.Second)
|
||||
os.Exit(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue