grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
Merged in access-control (pull request #4)
2019-05-08, Gary Kramlich
d5886fd34dc1
Merged in access-control (pull request #4)
access: implement
Approved-by: Gary Kramlich
package
main
import
(
"os"
"github.com/alecthomas/kong"
log
"github.com/sirupsen/logrus"
"bitbucket.org/rw_grim/hgkeeper/serve"
"bitbucket.org/rw_grim/hgkeeper/setup"
)
type
commands
struct
{
ReposPath
string
`kong:"flag,name='repos-path',default='repos',help='the directory where the repository are stored'"`
Serve
serve
.
Command
`kong:"cmd,help='run the ssh server'"`
Setup
setup
.
Command
`kong:"cmd,help='inital setup for the server'"`
}
func
init
()
{
log
.
SetOutput
(
os
.
Stdout
)
log
.
SetLevel
(
log
.
DebugLevel
)
fmter
:=
&
log
.
TextFormatter
{
FullTimestamp
:
true
,
}
switch
os
.
Getenv
(
"TERM"
)
{
case
"win"
:
fallthrough
case
"dumb"
:
fmter
.
DisableColors
=
true
}
log
.
SetFormatter
(
fmter
)
}
func
main
()
{
cmd
:=
commands
{}
ctx
:=
kong
.
Parse
(
&
cmd
)
err
:=
ctx
.
Run
(
cmd
.
ReposPath
)
ctx
.
FatalIfErrorf
(
err
)
}