Show HN: 1Poshword, cross-platform PowerShell client for 1Password
github.com
github.com
To be pronounced in Sean Connery's voice... though that'd be more like 1Pashword.
[1] - https://github.com/PowerShell/PowerShell [2] - https://github.com/PowerShell/PowerShell/#get-powershell
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 subject to change if he ever rewrites something (lib.ps1).
- 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-appropriate newline (fixed a bug here just this morning)
- Avoid BOMs when writing files, unix doesn't like them (use [IO.File]::WriteAllText, not Out-File. Sad.)
- Need to restrict yourself to powershell cmdlets and .NET APIs that are available in the open-source version of powershellSet-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.
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.
awesome