package knit import ( "errors" "os" "os/exec" ) // DefaultHost is the default host for tangled.sh services const DefaultHost = "tangled.sh" // DefaultKnot is the default knot host const DefaultKnot = "knot1.tangled.sh" // ErrRequiresAuth is returned when a command requires authentication but the // user has not authenticated with the host var ErrRequiresAuth = errors.New("authentication required") func Editor() string { e := os.Getenv("EDITOR") if e != "" { return e } options := []string{"nvim", "vim", "nano"} for _, opt := range options { _, err := exec.LookPath(opt) if err != nil { continue } return opt } return "vi" }