Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve usage documentation #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,44 @@ package config

import (
"flag"
"fmt"

log "github.com/sirupsen/logrus"
)

var Port int
var Directory string
var LogLevel string
var (
Port int
Directory string
LogLevel string
)

func initFlags() {
flag.IntVar(&Port, "p", 5030, "port")
flag.StringVar(&Directory, "d", ".", "directory")
flag.StringVar(&LogLevel, "log-level", "info", "log level")
flag.Usage = usage
flag.IntVar(&Port, "p", 5030, "Port to use (default 5030)")
flag.StringVar(&Directory, "d", ".", "Directory to serve (default '.')")
flag.StringVar(
&LogLevel,
"log-level",
"info",
"Set the logging level ('info', 'debug', 'warn', 'error') (default 'info')",
)
}

func usage() {
fmt.Println("usage: restatic [options]")
fmt.Println("")
fmt.Println("A simple HTTP server that serves a local directory over HTTP.")
fmt.Println("")
fmt.Println("options:")
fmt.Println(" -p --port Port to use (default 5030)")
fmt.Println(" -d --directory Directory to serve (default '.')")
fmt.Println(
" --log-level Set the logging level ('info', 'debug', 'warn', 'error') (default 'info')",
)
fmt.Println("")
fmt.Println(
"Read README.md for more help on how to use restatic",
)
}

func initLog() {
Expand Down