Builtins: set now puts the variables in the most local frame by default
This commit is contained in:
parent
3d7bf1029e
commit
c2ba92518e
|
@ -28,6 +28,9 @@ let builtins: array[6, string] = [
|
||||||
"cd",
|
"cd",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# number of frames to be used for builtins like set
|
||||||
|
var numframes: int=1
|
||||||
|
|
||||||
# Exception types
|
# Exception types
|
||||||
type
|
type
|
||||||
ShellError= object of CatchableError
|
ShellError= object of CatchableError
|
||||||
|
@ -254,7 +257,7 @@ proc runBuiltin(builtin: string, args: openArray[string]): (string, int) =
|
||||||
of "set":
|
of "set":
|
||||||
if args.len < 2:
|
if args.len < 2:
|
||||||
raise newShellCommandException("Not enough arguments provided", "set")
|
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)
|
return ("", 0)
|
||||||
of "setenv":
|
of "setenv":
|
||||||
if args.len < 2:
|
if args.len < 2:
|
||||||
|
|
Loading…
Reference in New Issue