netcaptain/cmd/ncpt/app_quest_cmds.go

27 lines
478 B
Go
Raw Normal View History

2020-10-09 20:45:04 +00:00
package main
import (
"fmt"
"os"
"os/exec"
)
func (a *AppState) runQuest(parms []string) int {
return 0
}
func (a *AppState) editQuest(parms []string) int {
if len(parms) == 0 {
fmt.Println("Quest name must be provided.")
return 1
}
cmd := exec.Command(os.Getenv("EDITOR"), fmt.Sprintf("%s/%s", a.ConfDir, parms[0]))
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
err := cmd.Run()
if err != nil {
fmt.Printf("Error editing Quest (%s)", parms[0])
}
return 0
}