Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to call powershell commands without the double backtick #76

Open
voronoipotato opened this issue Dec 3, 2016 · 5 comments

Comments

@voronoipotato
Copy link

voronoipotato commented Dec 3, 2016

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.

@vasily-kirichenko
Copy link
Contributor

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.

@sergey-tihon
Copy link
Member

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

@voronoipotato
Copy link
Author

voronoipotato commented Dec 6, 2016

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

@sergey-tihon
Copy link
Member

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)

@voronoipotato
Copy link
Author

voronoipotato commented Dec 20, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants