You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zk/cmd/init.go

27 lines
500 B
Go

package cmd
import (
"fmt"
"path/filepath"
"github.com/mickael-menu/zk/core/zk"
)
// Init creates a notebook in the given directory
type Init struct {
Directory string `arg optional type:"path" default:"." help:"Directory containing the notebook."`
}
func (cmd *Init) Run() error {
err := zk.Create(cmd.Directory)
if err == nil {
path, err := filepath.Abs(cmd.Directory)
if err != nil {
path = cmd.Directory
}
fmt.Printf("Initialized a notebook in %v\n", path)
}
return err
}