Compare commits
2 Commits
configs
...
93d2163ce9
| Author | SHA1 | Date | |
|---|---|---|---|
|
93d2163ce9
|
|||
|
1634321bd2
|
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"mount": [],
|
|
||||||
"romount": ["/etc", "/var", "/usr", "/opt", ".oh-my-zsh", ".zsh", ".zshrc"],
|
|
||||||
"symlinks": [
|
|
||||||
{"src": "usr/lib", "dst": "/lib"},
|
|
||||||
{"src": "usr/lib64", "dst": "/lib64"},
|
|
||||||
{"src": "usr/bin", "dst": "/bin"},
|
|
||||||
{"src": "usr/sbin", "dst": "/sbin"}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -38,4 +38,7 @@ proc parseArgs*(): Option[Args] =
|
|||||||
if command.len > 0:
|
if command.len > 0:
|
||||||
args.cmd = some(command)
|
args.cmd = some(command)
|
||||||
|
|
||||||
return some(args)
|
if args.name.isSome or args.cmd.isSome or args.profile.isSome:
|
||||||
|
return some(args)
|
||||||
|
else:
|
||||||
|
return none(Args)
|
||||||
|
|||||||
@@ -15,9 +15,19 @@ proc checkRelativePath*(p: string): string =
|
|||||||
getHomeDir().joinPath(p)
|
getHomeDir().joinPath(p)
|
||||||
|
|
||||||
proc getProfilePath*(profile: string): string =
|
proc getProfilePath*(profile: string): string =
|
||||||
getConfigDir()
|
let pid = getCurrentProcessId()
|
||||||
.joinPath(APP_NAME)
|
|
||||||
.joinPath(profile)
|
for path in [
|
||||||
|
getConfigDir().joinPath(APP_NAME),
|
||||||
|
&"/usr/share/{APP_NAME}",
|
||||||
|
parentDir(expandSymlink(&"/proc/{pid}/exe")).joinPath("configs")
|
||||||
|
]:
|
||||||
|
let file = path.joinPath(profile)
|
||||||
|
|
||||||
|
if fileExists(file):
|
||||||
|
return file
|
||||||
|
|
||||||
|
raise newException(IOError, "Profile not found")
|
||||||
|
|
||||||
proc getProfilePath*(args: Args): string =
|
proc getProfilePath*(args: Args): string =
|
||||||
getProfilePath(args.getProfile())
|
getProfilePath(args.getProfile())
|
||||||
|
|||||||
1
main.nim
1
main.nim
@@ -5,7 +5,6 @@ import random
|
|||||||
|
|
||||||
proc main(): int =
|
proc main(): int =
|
||||||
let args = parseArgs()
|
let args = parseArgs()
|
||||||
echo args
|
|
||||||
|
|
||||||
if args.isNone:
|
if args.isNone:
|
||||||
echo "Usage: bwshell --name=sandbox_name --profile=profile <sandbox_cmd>"
|
echo "Usage: bwshell --name=sandbox_name --profile=profile <sandbox_cmd>"
|
||||||
|
|||||||
Reference in New Issue
Block a user