|
| 1 | +using CommandLine; |
| 2 | +using System; |
| 3 | +using System.Collections.Generic; |
| 4 | +using System.Linq; |
| 5 | +using System.Text; |
| 6 | +using System.Threading.Tasks; |
| 7 | + |
| 8 | +namespace Zephyr |
| 9 | +{ |
| 10 | + [Verb("run", isDefault: true, HelpText = "Run a Zephyr file")] |
| 11 | + internal class CommandLineOptions |
| 12 | + { |
| 13 | + [Option('f', "file", HelpText = "The Zephyr code file to execute")] |
| 14 | + public string? FileNameFlag { get; set; } = null; |
| 15 | + |
| 16 | + [Value(0, HelpText = "The Zephyr code file to execute")] |
| 17 | + public string? FileName { get; set; } = null; |
| 18 | + |
| 19 | + [Option('p', "pipe", HelpText = "The file path to pipe the output to")] |
| 20 | + public string? Pipe { get; set; } = null; |
| 21 | + |
| 22 | + [Option('c', "config", HelpText = "The config file for the application, this can contain all permissions etc")] |
| 23 | + public string? Config { get; set; } = null; |
| 24 | + |
| 25 | + [Option("max-runtime", HelpText = "The amount of seconds the program is allowed to execute for")] |
| 26 | + public int? MaxRuntime { get; set; } = null; |
| 27 | + |
| 28 | + [Option("max-iterations", HelpText = "The max amount of iterations a loop is allowed to make", Default = 10000)] |
| 29 | + public int MaxLoopIterations { get; set; } = 10000; |
| 30 | + |
| 31 | + [Option("no-iteration-limit", HelpText = "Whether or not the loop iteration limit should be disabled", Default = false)] |
| 32 | + public bool NoIterationLimit { get; set; } = false; |
| 33 | + |
| 34 | + [Option('a', "file-access", HelpText = "The file permissions the program has access to.\nr = read, w = write, d = delete file, x = delete directory, c = create, n = none\nExample: --file-access=rwdc, -a=n", Default = "rwdxc")] |
| 35 | + public string FileAccessFlags { get; set; } = "rwdxc"; |
| 36 | + |
| 37 | + [Option("system-details", HelpText = "Whether or not the program has access to system details, e.g. username, operating system etc.", Default = true)] |
| 38 | + public bool CanAccessSystemDetails { get; set; } = true; |
| 39 | + |
| 40 | + [Option("debug", HelpText = "Whether or not the interpreter should produce debug information", Default = false)] |
| 41 | + public bool Debug { get; set; } = false; |
| 42 | + |
| 43 | + [Option("verbose", HelpText = "Whether or not the interpreter should produce verbose log information", Default = false)] |
| 44 | + public bool Verbose { get; set; } = false; |
| 45 | + |
| 46 | + [Option("os-apis", HelpText = "Whether or not the program can access OS api's such as user32.dll", Default = true)] |
| 47 | + public bool CanUseSystemAPIs { get; set; } = true; |
| 48 | + |
| 49 | + [Option("can-spawn-processes", HelpText = "Whether or not the program can spawn processes\nDANGEROUS: This will mean it can execute ANY operation on the system", Default = true)] |
| 50 | + public bool CanSpawnProcesses { get; set; } = true; |
| 51 | + |
| 52 | + // This is just here for visual |
| 53 | + [Option("args", HelpText = "Everything after will count as the args for the Zephyr application")] |
| 54 | + public string? Args { get; set; } = null; |
| 55 | + } |
| 56 | + |
| 57 | + [Verb("install-package", HelpText = "Install a Zephyr package from a repository")] |
| 58 | + internal class CommandLineOptionsInstallPackage |
| 59 | + { |
| 60 | + [Value(0, HelpText = "The package to install", Required = true)] |
| 61 | + public string PackageName { get; set; } = ""; |
| 62 | + |
| 63 | + [Value(0, HelpText = "The version of the package", Default = "@latest")] |
| 64 | + public string PackageVersion { get; set; } = "@latest"; |
| 65 | + |
| 66 | + [Option('r', "repository", HelpText = "The repository URL from which to download the packages", Default = "http://localhost:3000")] |
| 67 | + public string RepositoryUrl { get; set; } = ""; |
| 68 | + } |
| 69 | + |
| 70 | + [Verb("new", HelpText = "Initiate a new Zephyr project / package")] |
| 71 | + internal class CommandLineOptionsCreatePackage |
| 72 | + { |
| 73 | + |
| 74 | + } |
| 75 | +} |
0 commit comments