From c2ba92518e20ce45515f7188bc1ca0fc48681021 Mon Sep 17 00:00:00 2001 From: Sekulum Forka Date: Mon, 17 May 2021 17:13:58 +0200 Subject: [PATCH] Builtins: set now puts the variables in the most local frame by default --- src/fsh.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fsh.nim b/src/fsh.nim index 3787401..99ef403 100644 --- a/src/fsh.nim +++ b/src/fsh.nim @@ -28,6 +28,9 @@ let builtins: array[6, string] = [ "cd", ] +# number of frames to be used for builtins like set +var numframes: int=1 + # Exception types type ShellError= object of CatchableError @@ -254,7 +257,7 @@ proc runBuiltin(builtin: string, args: openArray[string]): (string, int) = of "set": if args.len < 2: raise newShellCommandException("Not enough arguments provided", "set") - shellVariables[0][args[0]] = args[1..^1].join(" ") + shellVariables[numframes-1][args[0]] = args[1..^1].join(" ") return ("", 0) of "setenv": if args.len < 2: