command_terminal icon indicating copy to clipboard operation
command_terminal copied to clipboard

Add helper method to convert to any enum

Open Sirrah opened this issue 6 years ago • 4 comments

This adds a helper to convert a command argument to the given enum type. I've created a method, instead of a property, so that it can accept a generic type.

The behavior is similar to the existing helpers, i.e. parsing is case insensitive and return the default value for the given type in case of an error.

Sirrah avatar Nov 03 '18 14:11 Sirrah

Nice! This is also a feature of my fork Command Terminal Plus, maybe you'd be interested in that.

JimmyCushnie avatar Nov 09 '18 09:11 JimmyCushnie

Looks good. Your implementation is a bit more explicit about types which is nice. Have you tried merging this or any other features back to this repo?

Sirrah avatar Nov 09 '18 09:11 Sirrah

You mean making pull requests? I did try that, but I'm new to git/github and fucked it up. Plus, seeing great and simple PRs like yours and this one go for so long without being acknowledged by @stillwwater is pretty discouraging.

If @stillwwater becomes active again I might make a bunch of PRs for him to review. But until then I'll just keep developing on my own fork. If you want to submit PRs to that, I promise to be timely about reviewing them 😉

JimmyCushnie avatar Nov 09 '18 11:11 JimmyCushnie

This is a great addition, just change the formatting to be consistent with the rest of the code and I'll merge it. Also I'd prefer using TryParse instead of catching the exception, and using Terminal.Shell.IssueErrorMessage if parsing fails.

Thanks!

Edit: @JimmyCushnie I appreciate the concern, but with uni, work and other Unity projects it's difficult to handle everything, which is why I appreciate other people helping out! Though I don't want this project becoming too cluttered, Command Terminal was always meant to be simple enough that people can easily modify it to suit their own projects.

stillwwater avatar Nov 17 '18 19:11 stillwwater