[*] Update cmd test
This commit is contained in:
parent
0ea0669f4a
commit
b6c90f5069
@ -1 +1 @@
|
||||
Subproject commit 191f5df2a13e959e67114de9e8f97cf2f1d7d6ff
|
||||
Subproject commit 9c18cb06e0f2665c281365a586faa102cac3e523
|
@ -7,8 +7,31 @@
|
||||
***/
|
||||
#include <AuroraRuntime.hpp>
|
||||
|
||||
/**
|
||||
* Different shells will parse execv or generate the process command line string differently
|
||||
* For instance, to take the flag 'Hello World' and pass it to a program without additional CLI parsing, you would need to write:
|
||||
*
|
||||
* Powershell: & '.\3. Hello Command Line.Stage.Win32.x86_64.exe' Hello` World
|
||||
* CMD : "3. Hello Command Line.Stage.Win32.x86_64.exe" "Hello World"
|
||||
* Linux : ./3.\ Hello\ Command\ Line.Stage.Linux.x86_64 Hello\ World
|
||||
*
|
||||
* Despite this, GetFlags and GetValues will unescape \\ on NT platforms.
|
||||
*
|
||||
* EG: "3. Hello Command Line.Stage.Win32.x86_64.exe" --test=Hello\ World
|
||||
* [2022-02-20 18:25:48][Info] | Flags: 0
|
||||
* [2022-02-20 18:25:48][Info] | Values: 1
|
||||
* [2022-02-20 18:25:48][Info] | --test=Hello World
|
||||
*/
|
||||
|
||||
static void PrintAll()
|
||||
{
|
||||
const auto &args = AuCmdLine::GetCommandLineArguments();
|
||||
AuLogInfo("Command Line Arguments: {}", args.size());
|
||||
for (const auto &arg : args)
|
||||
{
|
||||
AuLogInfo(" {}", arg);
|
||||
}
|
||||
|
||||
const auto &flags = AuCmdLine::GetFlags();
|
||||
AuLogInfo("Flags: {}", flags.size());
|
||||
for (const auto &flag : flags)
|
||||
@ -32,11 +55,4 @@ void RunTests()
|
||||
Aurora::RuntimeStart(info);
|
||||
|
||||
PrintAll();
|
||||
|
||||
// Different command line interfaces will parse execv or generate the process command line string differently
|
||||
// For instance, the flag 'hello world' looks like this across different platforms
|
||||
//
|
||||
// Powershell: & '.\3. Hello Command Line.Stage.Win32.x86_64.exe' Hello` World
|
||||
// CMD : "3. Hello Command Line.Stage.Win32.x86_64.exe" "Hello World"
|
||||
// Linux : ./3.\ Hello\ Command\ Line.Stage.Linux.x86_64 Hello\ World
|
||||
}
|
Loading…
Reference in New Issue
Block a user