adamralph / bau

The C# task runner
MIT License
152 stars 17 forks source link

Split ColorConsole out to separate project #177

Closed davetimmins closed 10 years ago

davetimmins commented 10 years ago

This moves the ColorConsole stuff into a separate project. I left the usage within Bau the same with the exception of changing WriteLine(null) to just WriteLine().

There is also the option to call it as below

ColorConsole.WriteLine(
    "Press".Colored(ConsoleColor.Gray),
    " Esc ".Colored(ConsoleColor.Red),
    "to exit".Colored(ConsoleColor.Gray));
adamralph commented 10 years ago

Awesome! Thanks very much. I'll review it ASAP. I'm on the road right now with a phone only so I'm afraid it will have to wait until next week. This is a great step towards spinning this off as a separate nupkg. On 25 Aug 2014 22:31, "Dave Timmins" notifications@github.com wrote:

This moves the ColorConsole stuff into a separate project. I left the usage within Bau the same with the exception of changing WriteLine(null) to just WriteLine().

There is also the option to call it as below

ColorConsole.WriteLine( "Press".Colored(ConsoleColor.Gray), " Esc ".Colored(ConsoleColor.Red), "to exit".Colored(ConsoleColor.Gray));


You can merge this Pull Request by running

git pull https://github.com/davetimmins/bau split-out-color-console

Or view, comment on, or merge it at:

https://github.com/bau-build/bau/pull/177 Commit Summary

  • split ColorConsole out to separate project

File Changes

Patch Links:

— Reply to this email directly or view it on GitHub https://github.com/bau-build/bau/pull/177.

davetimmins commented 10 years ago

No problem. Yea would be great as a package, been using it for a recent project as there's nothing else as nice / easy to use from what I could see.

davetimmins commented 10 years ago

Also noticed that if you do something like

ColorConsole.WriteLine(
    "Press",
    " Esc ".Colored(ConsoleColor.Red),
    "to exit");

at the moment it will use the last set colour, so "Esc to exit", would all be red. Changing the implicit string operator for ColorToken to use the default colour of white can resolve this

public static implicit operator ColourToken(string text)
{
    return new ColourToken(text, ConsoleColor.White);
}
adamralph commented 10 years ago

Thanks for hanging in there. I'm afraid I still can't get onto this for a while, but the behaviour you mention surprises me. I thought I designed it so that the current colour is reverted after the rendering of each token but I guess I may be mistaken.

davetimmins commented 10 years ago

Ah you're right, must've been imagining things sorry :sob:

adamralph commented 10 years ago

@davetimmins sorry there's been no movement on this for a while.

I had a think about it and I decided that I didn't really want the project sitting as a separate DLL in Bau, but your change inspired me to go the whole hog and spin it off as a separate repo and package. See https://github.com/colored-console/colored-console and https://www.nuget.org/packages/ColoredConsole/.

The new repo is based on the current dev branch in Bau, so it doesn't contain the API enhancements you made, i.e. the WriteLine overloads and the string extension method. If you'd like to raise a PR over at the colored-console project I'd be more than happy to accept them there.

Furthermore, given your interest, would you like to join me in co-managing the colored-console repo as a committer?

davetimmins commented 10 years ago

That's great and good timing as I am about to use it again. I'll make the changes over there and submit a new PR.

Yes I'd be happy to co-manage the colored-console repository.

adamralph commented 10 years ago

Great! I've invited you to become an owner of the colored-console org. I'll take a look at your PR there ASAP.