Removed unused functions
This commit is contained in:
parent
057e4ac21b
commit
731f1a6791
|
@ -12,7 +12,6 @@ import (
|
||||||
|
|
||||||
var Port int
|
var Port int
|
||||||
var Recursive bool
|
var Recursive bool
|
||||||
var Verbose bool
|
|
||||||
|
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "roulette <path1> [path2] ... [pathN]",
|
Use: "roulette <path1> [path2] ... [pathN]",
|
||||||
|
@ -35,6 +34,5 @@ func Execute() {
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.Flags().IntVarP(&Port, "port", "p", 8080, "port to listen on")
|
rootCmd.Flags().IntVarP(&Port, "port", "p", 8080, "port to listen on")
|
||||||
rootCmd.Flags().BoolVarP(&Recursive, "recursive", "r", false, "recurse into subdirectories")
|
rootCmd.Flags().BoolVarP(&Recursive, "recursive", "r", false, "recurse into subdirectories")
|
||||||
rootCmd.Flags().BoolVarP(&Verbose, "verbose", "v", false, "also write output to stdout")
|
|
||||||
rootCmd.Flags().SetInterspersed(false)
|
rootCmd.Flags().SetInterspersed(false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Version = "0.1.0"
|
var Version = "0.1.1"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(versionCmd)
|
rootCmd.AddCommand(versionCmd)
|
||||||
|
|
14
cmd/web.go
14
cmd/web.go
|
@ -60,20 +60,6 @@ func statusNotFound(w http.ResponseWriter, filePath string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func statusForbidden(w http.ResponseWriter, filePath string) error {
|
|
||||||
fmt.Println("Client requested forbidden file " + filePath + ".")
|
|
||||||
|
|
||||||
w.WriteHeader(http.StatusForbidden)
|
|
||||||
w.Header().Set("Content-Type", "txt/plain")
|
|
||||||
htmlBody := "Access denied."
|
|
||||||
_, err := io.WriteString(w, htmlBody)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func serveStaticFile(w http.ResponseWriter, request string, paths []string) error {
|
func serveStaticFile(w http.ResponseWriter, request string, paths []string) error {
|
||||||
filePath, err := url.QueryUnescape(request)
|
filePath, err := url.QueryUnescape(request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue