27 lines
478 B
Go
27 lines
478 B
Go
|
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
|
||
|
}
|