Code development platform for open source projects from the European Union institutions

Skip to content

Draft: Refactor VECTO Console

David AMO GONZALEZ requested to merge refactor/vecto_console_full into amdm2/develop

Legend

: Done. Not fully implemented. Not implemented/considered. ️ To be done.

1. Refactor WriteXXXLine to accept STDOUT and STDERR

2. Use argument parser

https://stackoverflow.com/questions/491595/best-way-to-parse-command-line-arguments-in-c

vecto/vecto!81 (comment 69390)

Arguments to implement:

  • ams: append manufacturing step
  • t: output information about execution times
  • mod: write mod-data in addition to sum-data
  • 1Hz: convert mod-data to 1Hz resolution
  • eng: switch to engineering mode (implies -mod)
  • q: quiet - disables console output unless verbose information is enabled
  • nv: skip validation of internal data structure before simulation
  • v: Shows verbose information (errors and warnings will be displayed)
  • vv: Shows more verbose information (infos will be displayed)
  • vvv: Shows debug messages (slow!)
  • vvvv: Shows all verbose information (everything, slow!)
  • V: show version information
  • h: Displays this help.

See Mono.Options documentation:

https://github.com/xamarin/XamarinComponents/blob/main/XPlat/Mono.Options/GettingStarted.md

or

https://github.com/xamarin/XamarinComponents/tree/main/XPlat/Mono.Options

3. Stop execution when asking for app version via command -v

I would separate the 2 cases, and stop when explicitly asking app-version:

Line 194:

-    if (args.Contains("-V") || _debugEnabled) {
-        ShowVersionInformation();
-    }
+    if (args.Contains("-V")) {
+        ShowVersionInformation(Console);
+            return 0;
+    }
+    else if (_debugEnabled) {
+        ShowVersionInformation(Console.Error);
+    }

vecto/vecto!81 (comment 69391)

4. Let exceptions "bubble up" and handle on final step

See 69392 and for the "above" see 69393.

5. Use speaking names for existing commands

Create speaking names for the following commands:

  • --version
  • --help
  • v, vv, vvv, vvvv

Make it possible to be backwards compatible, i.e. do not deprecate the existing solution.

Consider implementation alongside 2. Use argument parser.

6. ️ Add logger

Either add a logger or use the half implemented one.

Problems and considerations:

  • Is it supported on Debug mode only?
  • Specify an output for all cases (Debug, Release, etc.)
    1. File
    2. Terminal

Current situation: log console messages and other outputs in existing logger. Considerations above still need to be addressed.

7. ️ Update VECTO Console documentation

Consider using tool for auto-generating the help or man page. Either entire documentation or part of it.

Considerations:

  • Find speaking name for -1Hz.
  • Find out reason for -act command. Done
  • Do we want to re-introduce/re-support -act command? No
Edited by David AMO GONZALEZ

Merge request reports