mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -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 (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
@ -57,6 +59,15 @@ respond with a file listing.`,
|
|||
cmd.Flags().BoolP("access-log", "", false, "Enable the access log")
|
||||
cmd.Flags().BoolP("debug", "v", false, "Enable verbose debug logs")
|
||||
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…
Reference in a new issue