-
Notifications
You must be signed in to change notification settings - Fork 19
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
ConvertTo-EOL cmdlet with -Unix and -Windows params #31
Comments
Also we can consider adding -EOLUnix/-EOLWindows parameters in Get-Content/Set-Content/Out-File @mklement0 It seems you had suggestions about this? |
@iSazonov, is there any kind of approval process or this could just be implement by anyone? |
@kasper3 Right way is to create RFC in https://github.com/PowerShell/PowerShell-RFC |
In-place update can be dangerous. We could create temp file, process and replace original file and have ip-place update as option. |
With |
So many parameters! Maybe: |
I think this has been a great discussion and the different options to consider I think warrants a RFC. Personally, I can see the EOL conversion to be part of a |
While I like the name, I'm a bit concerned that it would have pretty broad interpretation. What will users expect a cmdlet named Convert-File to do? Convert from, say, XML to JSON? From .doc to .docx? Or just encoding and line endings? |
@mklement0: I think that describes the intent better. |
@mklement0, you have much better hang on the shape of the cmdlet and arguments; would you consider opening an RFC based on the ideas shared here? :) |
@mklement0 would it be better to have [-LineEnding <Lf|CrLf>]? (or even <Lf|CrLf|Windows|Unix> to make it easier for novice users) |
Will MacOS users know they should be using Unix-style line endings? Also, would the cmdlet be able to recognize OS 9 style line endings (CR only) and be able to convert from those. Probably not much demand, but it was a thought. |
@mklement0 Convering from is all I was really concerned about. My sister, brother-in-law, and niece almost certainly don't know that MacOS has Unix under the covers, but they are not likely to be the PowerShell target audience, so you're probably right about that. And I would rather expect that even casual Linux users would know that it is a flavor of Unix. I have no strong preference here either. I'm just glad the cmdlet would be able to convert from old-style Mac line endings. |
I never like Lf/CrLf abbriviatury. I'd prefer |
Maybe without |
Usually EOL is used - so we could use If we want |
@PowerShell/powershell-committee reviewed this. We cannot simply replace Cr and Cr/Lf without knowing the encoding of the file (ie, UTF-8 vs UTF-16). Therefore, |
Is this feature going to be added. It would be very helpful. What is the status? |
Maybe such an implementation should be done in https://github.com/PowerShell/TextUtility?
|
It is as easy as use System.IO.StreamReader and System.IO.StreamWriter. |
This was brought up in today's Community Call and I think having it as a cmdlet part of TextUtility makes the most sense. Transferring this issue. |
This is a dupe of #17 |
Often I use utilities like
unixtodos.exe
anddostounix.exe
to fix the line endings of documents. It would be super helpful if PowerShell team consider it as a useful utility and provide it OOTB.One solution is: https://stackoverflow.com/a/19128003 but it "almost" works as "mike z" mentioned.
The text was updated successfully, but these errors were encountered: