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.
27 lines
713 B
27 lines
713 B
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 project at")
|
|
bare := flag.Bool("bare", false, "Initialize the git repo as a bare repository")
|
|
remote := flag.Bool("remote", false, "Configure the git repo to allow it to be used as a remote endpoint")
|
|
|
|
cmd.Run(func() (context.Context, error) {
|
|
_, err := dehub.InitProject(*path,
|
|
dehub.InitBareRepo(*bare),
|
|
dehub.InitRemoteRepo(*remote),
|
|
)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("initializing repo at %q: %w", *path, err)
|
|
}
|
|
return nil, nil
|
|
})
|
|
}
|
|
|