FSharp.Management
FSharp.Management copied to clipboard
Is there any way to call powershell commands without the double backtick
So it's a bit inconvenient if I must always have the double backticks. I assume this is because of the dash. For example
PS.``Get-EventLog``(logName="Application", entryType=[|"Error"|], newest=2)
is it possible to change it to
PS.Get_EventLog(logName="Application", entryType=[|"Error"|], newest=2)
If yes, would it be very difficult to change? Thanks so much.
Double backticks are added automatically somewhere inside providedtypes.fs, it's great and we should not touch this.
Replacing dashes with underscores is simple, but must be done with backward compatibility in mind, i.e. by adding a static parameter flag.
I like backticks because it retain original command names and it clearly shows where you call PowerShell.
But if you (@voronoipotato) decide to implement this, please follow @vasily-kirichenko 's suggestion about the implementation
Gotcha, that makes sense. I wonder if it would be best if both were available.PS.``Get-EventLog``
seems like it would be hard to convince my coworkers this is a normal thing. We use powershell at work, and I think it would be nice to be able to use powershell through F#. However I'm relatively new to F#, so perhaps this is one of those newbie complaints. Thanks
But you can extend PS TP to have both options
The original one
type PS = PowerShellProvider< "Microsoft.PowerShell.Management;Microsoft.PowerShell.Core" >
PS.``Get-EventLog``(logName="Application", entryType=[|"Error"|], newest=2)
Without back-ticks
type PS = PowerShellProvider< "Microsoft.PowerShell.Management;Microsoft.PowerShell.Core", UseCamelCase = true >
PS.GetEventLog(logName="Application", entryType=[|"Error"|], newest=2)
That sounds like the way to go. I'm going to try and figure out what the steps are to implement this. FAKE I think uses it's own way of hooking into PS that lacks the type providers. I might talk to the guys who make it and see if they would be interested in using the PS type providers because it seems like having intellisense would make things much easier.