Have a look at the chapter about command handler in Deep into Pharo
because you have all you need
You can script the loading and execution of expressions easily.
People like julien, damien at Pharodays started to resume a better DSL
for command descriptions.
Le 13/4/16 19:48, Alistair Grant a écrit :
On Wed, Apr 13, 2016 at 05:55:22PM +0200, stepharo wrote:
I'd be happy to, thanks. Please let me know what I need to do to get
involved (and remember that this is my hobby and I don't get as much
time as I'd like, so my responses won't always be as fast as we'd like).
- start to see if you can write the scripts you want.
- identify missing functionality
- use OSSubprocess
Sure...
While the existing "st" handler has some uses, I think it will be a bit
limited as I expect that most of the scripts I would write would end up
being:
1. Load required packages
2. Maybe do some initialisation
3. Send (basically) a single message to start the real work
Which means that I have to maintain a separate file that adds little
value.
As implied above, I'd like the "script" to be distributable as either
one or two files and take advantage of:
* OO design
* Pharo's excellent development environment
* SUnit
I've hacked together a quick framework in which a "script" is actually a
a Monticello package. The package name is supplied on the command line
along with some pre-defined options and anything else required by the
script. The package is loaded and a message sent to the class of the
same name. E.g.:
pharo script.image cliscript WorkedHours Hours.xlsx
would load ConfigurationOfWorkedHours, load the package, and
send WorkedHours>>runWithHandler: theCliHandler. (The example script
then reads the Hours spreadsheet and calculates the total hours worked).
Current help text...
./pharo script.image cliscript --help
CliScript enables running "Monticello" scripts.
The script is identified by its package name. CliScript looks for a
configuration package with the same name in the local package cache,
loads it, and sends the runWithHandler: message to the class with the
same name.
Command line parameters:
packageName The package to load and execute.
Command line options:
--debug Halt at the start of the message
--log-transcript Redirect transcript output to transcript.log
I haven't had to use OSSubprocess yet, next steps include:
* Read XSLX spreadsheets instead of having to export to CSV.
The script mostly does date and time calculations, I need to confirm
that they are working properly in Tabular.
* Add logging (I haven't looked for any logging capability yet).
* Ideally, implement the ODS support in the Tabular package (stretch
goal :-)).
Thanks!
Alistair