Updated transitive dependencies
This commit is contained in:
parent
f6ac4b6e2b
commit
7184542cb6
|
@ -91,12 +91,6 @@ When accessed, these endpoints return the contents of the index, in HTML and JSO
|
||||||
```
|
```
|
||||||
Usage:
|
Usage:
|
||||||
roulette <path> [path]... [flags]
|
roulette <path> [path]... [flags]
|
||||||
roulette [command]
|
|
||||||
|
|
||||||
Available Commands:
|
|
||||||
completion Generate the autocompletion script for the specified shell
|
|
||||||
help Help about any command
|
|
||||||
version Print version
|
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
-b, --bind string address to bind to (default "0.0.0.0")
|
-b, --bind string address to bind to (default "0.0.0.0")
|
||||||
|
@ -111,6 +105,5 @@ Flags:
|
||||||
--stats expose stats endpoint
|
--stats expose stats endpoint
|
||||||
--stats-file string path to optional persistent stats file
|
--stats-file string path to optional persistent stats file
|
||||||
-v, --verbose log accessed files to stdout
|
-v, --verbose log accessed files to stdout
|
||||||
|
-V, --version display version and exit
|
||||||
Use "roulette [command] --help" for more information about a command.
|
|
||||||
```
|
```
|
19
cmd/files.go
19
cmd/files.go
|
@ -649,9 +649,10 @@ func normalizePath(path string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func normalizePaths(args []string) ([]string, error) {
|
func normalizePaths(args []string) ([]string, error) {
|
||||||
paths := []string{}
|
paths := make([]string, len(args))
|
||||||
|
|
||||||
fmt.Println("Paths:")
|
var pathList strings.Builder
|
||||||
|
pathList.WriteString("Paths:\n")
|
||||||
|
|
||||||
for i := 0; i < len(args); i++ {
|
for i := 0; i < len(args); i++ {
|
||||||
path, err := normalizePath(args[i])
|
path, err := normalizePath(args[i])
|
||||||
|
@ -670,23 +671,25 @@ func normalizePaths(args []string) ([]string, error) {
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case pathMatches && hasSupportedFiles:
|
case pathMatches && hasSupportedFiles:
|
||||||
fmt.Printf("%s\n", args[i])
|
pathList.WriteString(fmt.Sprintf("%s\n", args[i]))
|
||||||
addPath = true
|
addPath = true
|
||||||
case !pathMatches && hasSupportedFiles:
|
case !pathMatches && hasSupportedFiles:
|
||||||
fmt.Printf("%s (resolved to %s)\n", args[i], path)
|
pathList.WriteString(fmt.Sprintf("%s (resolved to %s)\n", args[i], path))
|
||||||
addPath = true
|
addPath = true
|
||||||
case pathMatches && !hasSupportedFiles:
|
case pathMatches && !hasSupportedFiles:
|
||||||
fmt.Printf("%s [No supported files found]\n", args[i])
|
pathList.WriteString(fmt.Sprintf("%s [No supported files found]\n", args[i]))
|
||||||
case !pathMatches && !hasSupportedFiles:
|
case !pathMatches && !hasSupportedFiles:
|
||||||
fmt.Printf("%s (resolved to %s) [No supported files found]\n", args[i], path)
|
pathList.WriteString(fmt.Sprintf("%s (resolved to %s) [No supported files found]\n", args[i], path))
|
||||||
}
|
}
|
||||||
|
|
||||||
if addPath {
|
if addPath {
|
||||||
paths = append(paths, path)
|
paths[i] = path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println()
|
if len(paths) > 0 {
|
||||||
|
fmt.Println(pathList.String())
|
||||||
|
}
|
||||||
|
|
||||||
return paths, nil
|
return paths, nil
|
||||||
}
|
}
|
||||||
|
|
12
cmd/root.go
12
cmd/root.go
|
@ -23,6 +23,7 @@ var (
|
||||||
statistics bool
|
statistics bool
|
||||||
statisticsFile string
|
statisticsFile string
|
||||||
verbose bool
|
verbose bool
|
||||||
|
version bool
|
||||||
|
|
||||||
rootCmd = &cobra.Command{
|
rootCmd = &cobra.Command{
|
||||||
Use: "roulette <path> [path]...",
|
Use: "roulette <path> [path]...",
|
||||||
|
@ -64,5 +65,16 @@ func init() {
|
||||||
rootCmd.Flags().BoolVar(&statistics, "stats", false, "expose stats endpoint")
|
rootCmd.Flags().BoolVar(&statistics, "stats", false, "expose stats endpoint")
|
||||||
rootCmd.Flags().StringVar(&statisticsFile, "stats-file", "", "path to optional persistent stats file")
|
rootCmd.Flags().StringVar(&statisticsFile, "stats-file", "", "path to optional persistent stats file")
|
||||||
rootCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "log accessed files to stdout")
|
rootCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "log accessed files to stdout")
|
||||||
|
rootCmd.Flags().BoolVarP(&version, "version", "V", false, "display version and exit")
|
||||||
rootCmd.Flags().SetInterspersed(true)
|
rootCmd.Flags().SetInterspersed(true)
|
||||||
|
|
||||||
|
rootCmd.CompletionOptions.HiddenDefaultCmd = true
|
||||||
|
|
||||||
|
rootCmd.SilenceErrors = true
|
||||||
|
rootCmd.SetHelpCommand(&cobra.Command{
|
||||||
|
Hidden: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
rootCmd.SetVersionTemplate("roulette v{{.Version}}\n")
|
||||||
|
rootCmd.Version = "0.46.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright © 2023 Seednode <seednode@seedno.de>
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cmd
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
|
||||||
|
|
||||||
var Version = "0.45.1"
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
rootCmd.AddCommand(versionCmd)
|
|
||||||
}
|
|
||||||
|
|
||||||
var versionCmd = &cobra.Command{
|
|
||||||
Use: "version",
|
|
||||||
Short: "Print version",
|
|
||||||
Long: "Print the version number of roulette",
|
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
|
||||||
fmt.Println("roulette v" + Version)
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -838,8 +838,6 @@ func serveMedia(paths []string, Regexes *Regexes, index *Index) http.HandlerFunc
|
||||||
func doNothing(http.ResponseWriter, *http.Request) {}
|
func doNothing(http.ResponseWriter, *http.Request) {}
|
||||||
|
|
||||||
func ServePage(args []string) error {
|
func ServePage(args []string) error {
|
||||||
fmt.Printf("roulette v%s\n\n", Version)
|
|
||||||
|
|
||||||
bindHost, err := net.LookupHost(bind)
|
bindHost, err := net.LookupHost(bind)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue