Removed unused utils.go
This commit is contained in:
parent
469cb96883
commit
bbe919be3b
|
@ -5,7 +5,7 @@ Copyright © 2022 Seednode <seednode@seedno.de>
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"os"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -27,8 +27,7 @@ var rootCmd = &cobra.Command{
|
||||||
func Execute() {
|
func Execute() {
|
||||||
err := rootCmd.Execute()
|
err := rootCmd.Execute()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
os.Exit(1)
|
||||||
panic(Exit{1})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
20
cmd/utils.go
20
cmd/utils.go
|
@ -1,20 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright © 2022 Seednode <seednode@seedno.de>
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cmd
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Exit struct{ Code int }
|
|
||||||
|
|
||||||
func HandleExit() {
|
|
||||||
if e := recover(); e != nil {
|
|
||||||
if exit, ok := e.(Exit); ok == true {
|
|
||||||
os.Exit(exit.Code)
|
|
||||||
}
|
|
||||||
panic(e)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Version = "0.4.0"
|
var Version = "0.4.1"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(versionCmd)
|
rootCmd.AddCommand(versionCmd)
|
||||||
|
|
|
@ -123,8 +123,6 @@ func servePageHandler(paths []string) http.HandlerFunc {
|
||||||
func doNothing(http.ResponseWriter, *http.Request) {}
|
func doNothing(http.ResponseWriter, *http.Request) {}
|
||||||
|
|
||||||
func ServePage(args []string) {
|
func ServePage(args []string) {
|
||||||
defer HandleExit()
|
|
||||||
|
|
||||||
paths, err := normalizePaths(args)
|
paths, err := normalizePaths(args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
Loading…
Reference in New Issue