github.com/soulteary/pocket-bookcase@v0.0.0-20240428065142-0b5a9a0fc98a/internal/cmd/serve.go (about)

     1  package cmd
     2  
     3  import (
     4  	"github.com/spf13/cobra"
     5  )
     6  
     7  func serveCmd() *cobra.Command {
     8  	cmd := &cobra.Command{
     9  		Use:   "serve",
    10  		Short: "Serve web interface for managing bookmarks",
    11  		Long: "Run a simple and performant web server which " +
    12  			"serves the site for managing bookmarks. If --port " +
    13  			"flag is not used, it will use port 8080 by default.",
    14  		Deprecated: "use server instead",
    15  		Run:        newServerCommandHandler(),
    16  	}
    17  
    18  	cmd.Flags().IntP("port", "p", 8080, "Port used by the server")
    19  	cmd.Flags().StringP("address", "a", "", "Address the server listens to")
    20  	cmd.Flags().StringP("webroot", "r", "/", "Root path that used by server")
    21  	cmd.Flags().Bool("log", true, "Print out a non-standard access log")
    22  	cmd.Flags().Bool("serve-web-ui", true, "Serve static files from the webroot path")
    23  
    24  	return cmd
    25  }