@@ -15,8 +15,6 @@ int main(int argc, char* argv[]) {
1515 const std::wstring outFileName = L" \\ output" ;
1616 bool running = true ;
1717
18- std::cout << " json2x " << VERSION_MAJOR << " ." << VERSION_MINOR << " \n " ;
19-
2018 while (running)
2119 {
2220 try
@@ -31,14 +29,17 @@ int main(int argc, char* argv[]) {
3129 throw std::exception (" Correct syntax is \" json2x <file-path> <language> <options>\"\n " );
3230 }
3331
34- for (int i = 0 ; i < argc; i++) {
32+ for (int i = 1 ; i < argc; i++) {
3533 args.push_back (argv[i]);
3634 }
3735
3836 running = false ; // Run once
3937 argc = 0 ; // Prevent args being used again
4038 }
4139 else {
40+
41+ std::cout << " json2x " << VERSION_MAJOR << " ." << VERSION_MINOR << " (shell mode) " << " \n " ;
42+
4243 std::cout << " >> " ;
4344
4445 std::string tempInput;
@@ -56,7 +57,9 @@ int main(int argc, char* argv[]) {
5657 }
5758 }
5859
59- CLOptions::parse (args);
60+ if (CLOptions::parse (args) != true ) {
61+ continue ;
62+ }
6063 }
6164
6265 // Load JSON file
@@ -73,7 +76,7 @@ int main(int argc, char* argv[]) {
7376 // Construct a code generator object with an indent style (4 spaces) and an initial class name ("MyClass")
7477 CodeGenerator generator (CLOptions::indent (), className);
7578
76- // Write generated code to a file if no parsing error occured
79+ // Get generated code if no parsing error occured
7780 std::string genOutput = generator.convertJson (json, CLOptions::langFormat ());
7881
7982 // Write generated code to file
0 commit comments