Abscissa / scriptlike

Utility library to help you write script-like programs in D
Other
93 stars 10 forks source link

Optional callback sink for command echoing #2

Closed Abscissa closed 10 years ago

Abscissa commented 10 years ago

Setting scriptlikeTraceCommands to true will echo commands to stdout, but there should be a way to override using stdout and allow to user to provide an OutputRange sink instead.

Abscissa commented 10 years ago

Changing issue's title:

What's really needed here is a callback function, not an OutputRange. Anything taking an arbitrary OutputRange needs to be templated: So using an OutputRange for echoing won't work unless everything that echoes is in a template that's instantiated by the user, which would make a mess of Scriptlike's API.

Instead, the optional custom sink for echoing should be a callback. The user can always provide a custom callback that sinks into whatever OutputRange they want, should they so desire.