grim/devweb
Clone
Summary
Browse
Changes
Graph
put some basic styling in place
draft
2021-01-25, Gary Kramlich
93e0bbec756e
put some basic styling in place
package
main
import
(
"fmt"
"github.com/alecthomas/kong"
"keep.imfreedom.org/grim/devweb/access"
"keep.imfreedom.org/grim/devweb/consts"
"keep.imfreedom.org/grim/devweb/db"
"keep.imfreedom.org/grim/devweb/server"
)
type
cli
struct
{
Access
access
.
Cmd
`kong:"cmd,help='Commands for managing API keys.'"`
Migrate
db
.
Cmd
`kong:"cmd,help='Create/Update the database to the most recent scheme.'"`
Serve
server
.
Cmd
`kong:"cmd,help='Run the server. This is the default command.',default='1'"`
Version
versionCmd
`kong:"cmd,help='Display the version number and exit.'"`
}
type
versionCmd
struct
{}
func
(
c
*
versionCmd
)
Run
()
error
{
fmt
.
Printf
(
"%s version %s\n"
,
consts
.
Name
,
consts
.
Version
)
return
nil
}
func
main
()
{
cli
:=
cli
{}
ctx
:=
kong
.
Parse
(
&
cli
,
kong
.
Name
(
consts
.
Name
),
kong
.
Description
(
consts
.
Description
),
kong
.
UsageOnError
(),
)
err
:=
ctx
.
Run
()
ctx
.
FatalIfErrorf
(
err
)
}