Builtins: set now puts the variables in the most local frame by default

This commit is contained in:
Sekulum Forka 2021-05-17 17:13:58 +02:00
parent 3d7bf1029e
commit c2ba92518e
1 changed files with 4 additions and 1 deletions

View File

@ -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: