mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-20 22:52:58 -05:00
fileserver: add export-template
sub-command to file-server
(#5630)
This commit is contained in:
parent
bbe1952a59
commit
27bc16abed
1 changed files with 11 additions and 0 deletions
|
@ -16,7 +16,9 @@ package fileserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -57,6 +59,15 @@ respond with a file listing.`,
|
||||||
cmd.Flags().BoolP("access-log", "", false, "Enable the access log")
|
cmd.Flags().BoolP("access-log", "", false, "Enable the access log")
|
||||||
cmd.Flags().BoolP("debug", "v", false, "Enable verbose debug logs")
|
cmd.Flags().BoolP("debug", "v", false, "Enable verbose debug logs")
|
||||||
cmd.RunE = caddycmd.WrapCommandFuncForCobra(cmdFileServer)
|
cmd.RunE = caddycmd.WrapCommandFuncForCobra(cmdFileServer)
|
||||||
|
cmd.AddCommand(&cobra.Command{
|
||||||
|
Use: "export-template",
|
||||||
|
Short: "Exports the default file browser template",
|
||||||
|
Example: "caddy file-server export-template > browse.html",
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
_, err := io.WriteString(os.Stdout, defaultBrowseTemplate)
|
||||||
|
return err
|
||||||
|
},
|
||||||
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue