bwbox/main.nim

25 lines
410 B
Nim
Raw Normal View History

2021-05-18 22:10:35 +02:00
import lib/sandbox
2021-05-16 20:35:01 +02:00
import strformat
import os
2021-05-18 22:10:35 +02:00
proc main() =
let mode = splitPath(getAppFilename()).tail
let args = commandLineParams()
let argc = paramCount()
2021-05-16 20:35:01 +02:00
2021-05-18 22:10:35 +02:00
if argc == 0:
echo &"Usage: {mode} <sandbox> [command]"
quit(1)
2021-05-16 20:35:01 +02:00
2021-05-18 22:10:35 +02:00
let name = args[0]
var command: string
2021-05-16 20:35:01 +02:00
2021-05-18 22:10:35 +02:00
if argc > 1:
command = args[1]
else:
command = getEnv("SHELL", "/bin/sh")
2021-05-16 20:35:01 +02:00
2021-05-18 22:10:35 +02:00
sandboxExec(name, command)
2021-05-16 20:35:01 +02:00
2021-05-18 22:10:35 +02:00
main()