You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
696 B
28 lines
696 B
4 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"fmt"
|
||
|
|
||
|
"dehub.dev/src/dehub.git"
|
||
|
"dehub.dev/src/dehub.git/cmd/dehub/dcmd"
|
||
|
)
|
||
|
|
||
|
func cmdInit(ctx context.Context, cmd *dcmd.Cmd) {
|
||
|
flag := cmd.FlagSet()
|
||
|
path := flag.String("path", ".", "Path to initialize the repo at")
|
||
|
bare := flag.Bool("bare", false, "Initialize the repo as a bare repository")
|
||
|
remote := flag.Bool("remote", false, "Configure the directory to allow it to be used as a remote endpoint")
|
||
|
|
||
|
cmd.Run(func() (context.Context, error) {
|
||
|
_, err := dehub.InitRepo(*path,
|
||
|
dehub.InitBare(*bare),
|
||
|
dehub.InitRemote(*remote),
|
||
|
)
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("initializing repo at %q: %w", *path, err)
|
||
|
}
|
||
|
return nil, nil
|
||
|
})
|
||
|
}
|