From 1f162af3e4bd46e5542960856fed253165ff003f Mon Sep 17 00:00:00 2001 From: Matthew Faltys Date: Wed, 13 Nov 2019 04:13:54 +0000 Subject: [PATCH] Add editing command --- nethack-launcher.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nethack-launcher.go b/nethack-launcher.go index 234a6fc..25f943b 100644 --- a/nethack-launcher.go +++ b/nethack-launcher.go @@ -198,6 +198,17 @@ func printUserScreen(redisClient *redis.Client, username string) string { exec.Command("stty", "-F", "/dev/tty", "echo", "-cbreak").Run() clearScreen() printWelcomeScreen(redisClient) + case "e": + hackRCLoc := fmt.Sprintf("%s/user/%s/.nethackrc", config.NethackLauncher.HackDir, username) + exec.Command("stty", "-F", "/dev/tty", "echo", "-cbreak").Run() + clearScreen() + nh := exec.Command("vim", hackRCLoc) + nh.Stdout = os.Stdout + nh.Stdin = os.Stdin + nh.Stderr = os.Stderr + nh.Run() + clearScree() + printUserScreen(redisClient, username) case "w": clearScreen() printProgressScreen(redisClient, username)