Description
Within execution we have richer information than an int
. We need to share this information.
Rust and Python’s argParse both use structures here and I think this is essential. I think we can maintain simplicity for the simple case – for example we could have a type that could be implicitly converted to int.
The key data for the return structure is:
• The integer return code
• A message to display to the user at completion
• Whether to continue, particularly whether to avoid post actions when we have them
• An id and/or indicator of what caused the return code to be set
• Possibly more information to help with debugging
Alternatives (for example implicit conversion to an integer) should support the simplicity of one of these code variations:
public static void Main(string args)
{
var cli = MyCreateCli();
return cli.Invoke(args);
return cli.Invoke(args).ReturnCode;
}
It would be highly desirable for this to include what to write to the console so the user can delay or collect output rather than having only the option to write to the console during action execution. For example, the CliAuthor may want to display progress as they proceed and then and then a summary at the end.
This struct could be part of the ParseResult. The parser plays an important role in the return since it offers return code and displays output to the user.
I am not suggesting that we go deep into the console problems prematurely, but the integer is not something we will be able to expand as we have richer options in the future.