toenuff / flancy

A micro web framework for Windows PowerShell
MIT License
189 stars 21 forks source link

Pass host from session if possible rather than call powershell.create() #4

Open toenuff opened 9 years ago

toenuff commented 9 years ago

In the typedefinition of flancy.flancy, need to see if we can use the host's runspace rather than calling powershell.create. If I can find the variable in my session, I should be able to pass it as a part of the constructor when creating a new flancy.flancy object.

beatcracker commented 8 years ago

Maybe this helps: How to get PowerShell current runspace from C#

Jaykul commented 8 years ago

I have an alternative implementation of all this, which does use the existing runspace. It started as an experiment with PowerShell classes, but I found that since Nancy uses callback lamdas instead of methods, there was no way to get the runspace/threading to work.

Anyway, when I failed to get PowerShell classes to work, I had a look at flancy, but I needed to run the code in the current runspace, and so I started from clean code. It ended up very differently than flancy, so I'm not really sure the two implementations can be considered compatible ...

I've pushed it up here https://github.com/Jaykul/NancyPS so you can look at it, if you're still actively interested in this stuff. We can have a conversation about merging functionality. They're obviously similar enough that the PowerShell community doesn't really need both... but they're different enough I'm not sure how to piece them together, since it would clearly break things to merge the two.

toenuff commented 8 years ago

I'll take a peek. Honestly, I really only care about the DSL on top. I like the flancy layout/syntax. Perhaps we can add that abstraction on top of what you have. I'll take a look and we can chat.