33 lines
799 B
Go
33 lines
799 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"codeberg.org/u1f320/filer/cmd/users"
|
|
"codeberg.org/u1f320/filer/cmd/web"
|
|
"github.com/rs/zerolog"
|
|
"github.com/rs/zerolog/log"
|
|
"github.com/rs/zerolog/pkgerrors"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
var app = &cli.App{
|
|
HelpName: "filer",
|
|
Usage: "Simple Go file server",
|
|
Commands: []*cli.Command{
|
|
web.Command,
|
|
users.Command,
|
|
},
|
|
}
|
|
|
|
func main() {
|
|
// set the logger to output to console format
|
|
// while performance is nice, the logger is not the place we'll ever get bottlenecked
|
|
// and the console output is friendlier
|
|
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr, TimeFormat: "[15:04:05]"})
|
|
zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack
|
|
|
|
if err := app.Run(os.Args); err != nil {
|
|
log.Error().Stack().Err(err).Msg("running app")
|
|
}
|
|
}
|