Debugging with Command Line Parameters
If you attempt to access the command line arguments in a console application that you are testing/debugging, then you will get the command line arguments used to start Dolphin. Normally this will include the image name argument, which is probably not want you want. To facilitate testing and debugging it is therefore worth splitting off your main routine into a separate method which accepts the argument array as a parameter, for example:
"Dump the contents of all the files listed as arguments to stdout"
| args |
args := self argv.
args from: 2 to: self argc do: [:f | | in |
in := FileStream read: f.
[in atEnd] whileFalse: [
self stdout nextPutAll: (in nextAvailable: 1024)]].
self stdout flush
self cat: self argv
This can then be tested as follows:
"Ensure there is a console (first time only)"
SessionManager current openConsole.
Catenate new cat: #('a.txt' 'b.txt')