Live data from Hacker News

Show HN: 1Poshword, cross-platform PowerShell client for 1Password

github.com

11–17 of 17 posts

Re: Show HN: 1Poshword, cross-platform PowerShell client for 1Password

#11
post #8
post #7

Earlier quoted context omitted.

Linux has had PowerShell support for a few weeks now, and if you look in the lib.ps1, you'll see that ClipboardCopy function tries clip.exe (Windows), then pbcopy (MacOS), then finally xclip (Linux). The module author used good form in dividing things up between the functions (cmdlets) that user should call from the PowerShell commandline and shouldn't change (1Poshword.psm1) and helper functions whose names are subj…

OP here. The open-sourcing and cross-platformizing of powershell itself makes it about 99% free to create "cross-platform" projects. A few specifics I came across from the remaining 1%: - Use platform-appropriate native tools (e.g. clip.exe/pbcopy/xclip as mentioned) - Use appropriate path separators (tip: just use / always - Windows handles it fine) - Be mindful of case-sensitive file paths - Use platform-appropriat…

Didn't clip have trouble with Unicode? There should be Set-Clipboard now, too (unless I got that from pscx or similar).

Re: Show HN: 1Poshword, cross-platform PowerShell client for 1Password

#12
post #11
post #8

Earlier quoted context omitted.

OP here. The open-sourcing and cross-platformizing of powershell itself makes it about 99% free to create "cross-platform" projects. A few specifics I came across from the remaining 1%: - Use platform-appropriate native tools (e.g. clip.exe/pbcopy/xclip as mentioned) - Use appropriate path separators (tip: just use / always - Windows handles it fine) - Be mindful of case-sensitive file paths - Use platform-appropriat…

Didn't clip have trouble with Unicode? There should be Set-Clipboard now, too (unless I got that from pscx or similar).

Thanks for the heads up, I didn't know about unicode problems in clip.exe. Do you have a link?

Set-Clipboard exists in full Windows Powershell, but not in Powershell "core" (open source version). I also didn't find a clipboard API in the current .NET core. So I went with native tools for now, and clip.exe is the only built-in option for Windows. If/when there is better xplat clipboard support in .NET or Powershell core I'll definitely move to that. Another option would be to check if Set-Clipboard exists and use it if so.

Re: Show HN: 1Poshword, cross-platform PowerShell client for 1Password

#17
post #12
post #11

Earlier quoted context omitted.

Didn't clip have trouble with Unicode? There should be Set-Clipboard now, too (unless I got that from pscx or similar).

Thanks for the heads up, I didn't know about unicode problems in clip.exe. Do you have a link? Set-Clipboard exists in full Windows Powershell, but not in Powershell "core" (open source version). I also didn't find a clipboard API in the current .NET core. So I went with native tools for now, and clip.exe is the only built-in option for Windows. If/when there is better xplat clipboard support in .NET or Powershell co…

Sorry, it's not clip that has problems with Unicode, but rather PowerShell when piping to native commands. I should have remembered that fact.

One can set $OutputEncoding to UTF16LE to make things work. In that case, clip has no problems with Unicode, but by default PowerShell will use CP1252 when piping data to native programs. Maybe the variable can be set differently only for your module.

Post reply on HN