bunpen: split autodetect
type into own file
This commit is contained in:
21
pkgs/additional/bunpen/config/autodetect.ha
Normal file
21
pkgs/additional/bunpen/config/autodetect.ha
Normal file
@@ -0,0 +1,21 @@
|
||||
// vim: set shiftwidth=2 :
|
||||
|
||||
export type autodetect = enum {
|
||||
EXISTING,
|
||||
EXISTING_FILE,
|
||||
EXISTING_FILE_OR_PARENT,
|
||||
EXISTING_OR_PARENT,
|
||||
PARENT,
|
||||
};
|
||||
|
||||
fn autodetect_fromstr(v: str) (autodetect | error) = {
|
||||
return switch (v) {
|
||||
case "existing" => yield autodetect::EXISTING;
|
||||
case "existingFile" => yield autodetect::EXISTING_FILE;
|
||||
case "existingFileOrParent" => yield autodetect::EXISTING_FILE_OR_PARENT;
|
||||
case "existingOrParent" => yield autodetect::EXISTING_OR_PARENT;
|
||||
case "parent" => yield autodetect::PARENT;
|
||||
case => yield error;
|
||||
};
|
||||
};
|
||||
|
@@ -20,14 +20,6 @@ export type cli_opts = struct {
|
||||
run_paths: []str,
|
||||
};
|
||||
|
||||
export type autodetect = enum {
|
||||
EXISTING,
|
||||
EXISTING_FILE,
|
||||
EXISTING_FILE_OR_PARENT,
|
||||
EXISTING_OR_PARENT,
|
||||
PARENT,
|
||||
};
|
||||
|
||||
export fn usage() void = {
|
||||
fmt::println("bunpen: run a program within an environment where access to external resources (files, net, certain IPC, ...) is restricted (i.e. sandbox)")!;
|
||||
fmt::println("USAGE: bunpen [sandbox-arg ...] program [sandbox-arg|program-arg ...] [--] [program-arg ...]")!;
|
||||
@@ -120,14 +112,3 @@ fn expect_arg(name: str, value: nullable *str) (str | error) = {
|
||||
case let v: *str => yield *v;
|
||||
};
|
||||
};
|
||||
|
||||
fn autodetect_fromstr(v: str) (autodetect | error) = {
|
||||
return switch (v) {
|
||||
case "existing" => yield autodetect::EXISTING;
|
||||
case "existingFile" => yield autodetect::EXISTING_FILE;
|
||||
case "existingFileOrParent" => yield autodetect::EXISTING_FILE_OR_PARENT;
|
||||
case "existingOrParent" => yield autodetect::EXISTING_OR_PARENT;
|
||||
case "parent" => yield autodetect::PARENT;
|
||||
case => yield error;
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user