Skip to content

Commit

Permalink
fileserver: add export-template sub-command to file-server (#5630)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammed90 authored Jul 13, 2023
1 parent bbe1952 commit 27bc16a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions modules/caddyhttp/fileserver/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ package fileserver

import (
"encoding/json"
"io"
"log"
"os"
"strconv"
"time"

Expand Down Expand Up @@ -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
},
})
},
})
}
Expand Down

0 comments on commit 27bc16a

Please sign in to comment.