The main method in a Terumi application should have a way to get the arguments of the program. Types such as string, and classes should be accepted as the first argument in a main method:
For the time being (primarily because we don't have arrays), argv will not be supported. On linux, argv will get joined by tabs (to help differentiate them from regular arguments spaces, but keeping them as whitespace.) On windows, GetCommandLine will be used.
Thus, as we're dealing with only strings currently, main can accept a single parameter: string or a type that has a parse_args_string(string) function, with an empty constructor (the empty constructor can be private _ctor). The following should work:
In the future, main should support a string array as an argument and for a type that is specified in main, it will need to have a parse_args_string_array(string[]) as well.
Feature description:
The
main
method in a Terumi application should have a way to get the arguments of the program. Types such asstring
, and classes should be accepted as the first argument in a main method:Suggested implementation:
Windows and Linux are vastly different. See this extremely useful guide on how command line argument parsing is done.
For the time being (primarily because we don't have arrays),
argv
will not be supported. On linux,argv
will get joined by tabs (to help differentiate them from regular arguments spaces, but keeping them as whitespace.) On windows,GetCommandLine
will be used.Thus, as we're dealing with only strings currently,
main
can accept a single parameter:string
or a type that has aparse_args_string(string)
function, with an empty constructor (the empty constructor can be private_ctor
). The following should work:Would print out with the args "--hello-world" assuming the script being run is
some/dir/a.exe
(a.exe could be a powershell script, doesn't matter):And for a class example:
Would print out with the args "--hello-world" assuming the script being run is
some/dir/a.exe
(a.exe could be a powershell script, doesn't matter):In the future,
main
should support a string array as an argument and for a type that is specified in main, it will need to have aparse_args_string_array(string[])
as well.