FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Added cross-platform Get-Clipboard and Set-Clipboard by SteveL-MSFT · Pull Request #10340 · PowerShell/PowerShell · GitHub

Added cross-platform Get-Clipboard and Set-Clipboard - #10340

Merged
Travis Plunk (TravisEz13) merged 29 commits into
PowerShell:masterfrom
SteveL-MSFT:clipboard-cmdlets
Nov 4, 2019
Merged

Added cross-platform Get-Clipboard and Set-Clipboard#10340
Travis Plunk (TravisEz13) merged 29 commits into
PowerShell:masterfrom
SteveL-MSFT:clipboard-cmdlets

Conversation

Steve Lee (SteveL-MSFT) commented Aug 10, 2019
edited
Loading

Copy link
Copy Markdown
Member

PR Summary

Re-enabled the existing Clipboard code for Windows which relies on the Clipboard class from WinForms. For Linux, it requires xclip and macOS pbcopy and pbpaste. Had to #ifdef out a bunch of code that only works on Windows for copy/pasting non-text types. On Linux/macOS, decided to retain the parameters even if not supported to provide a more detailed error message.

Had to modify typegen as one of the types in Winforms being used has no HashAlgorithm so typegen threw. Instead, it skips assemblies where no HashAlgorithm is used which appears to only be an Accessibility assembly associated with WinForms.

To support win-arm builds, creating new WINFORMS def in csproj and uses clip.exe to set the clipboard, but no cmdline tool on win-arm to get contents of clipboard so had to disable all tests on win-arm since it depends on getting content out.

To support PSXunit tests, default to Microsoft.NET.Sdk if SDKToUse is not explicitly defined.

PR Context

Fix #4307

PR Checklist

Comment thread build.psm1 Outdated
Comment thread build.psm1 Outdated
Comment thread build.psm1 Outdated
Comment thread build.psm1 Outdated
Comment thread build.psm1 Outdated
Comment thread build.psm1 Outdated
Comment thread build.psm1 Outdated
Comment thread build.psm1 Outdated
Comment thread build.psm1 Outdated

Copy link
Copy Markdown
Member Author

Not sure why XUnit tests are failing as it doesn't seem the changes here should have that effect so still investigating but repros locally.

Comment thread build.psm1 Outdated
Comment thread build.psm1 Outdated
Comment thread build.psm1 Outdated
Comment thread build.psm1 Outdated
Comment thread build.psm1 Outdated
Comment thread build.psm1 Outdated
Comment thread build.psm1 Outdated

Copy link
Copy Markdown
Member Author

The remaining Codacy issues are by-design as I don't want to #if out those members and code referring to them making it harder to read

Comment thread assets/files.wxs Outdated
Comment thread assets/files.wxs Outdated

Copy link
Copy Markdown
Member Author

@PowerShell/powershell-committee reviewed this, since the code exists for the PInvokes and we prefer consistency across different platforms, we agreed to remove dependency on WinForms and wait for feedback if any customer needs -Format

Steve Lee (SteveL-MSFT) added Committee-Reviewed PS-Committee has reviewed this and made a decision and removed Review - Committee The PR/Issue needs a review from the PowerShell Committee labels Oct 30, 2019

Sean Wheeler (sdwheeler) commented Oct 30, 2019
edited by unfurl-links Bot
Loading

Copy link
Copy Markdown
Collaborator

Steve Lee (@SteveL-MSFT)

The Get-Clipboard cmdlet gets the current Windows clipboard entry.
The Set-Clipboard cmdlet sets the current Windows clipboard entry.

Copy link
Copy Markdown
Member Author

Remaining Codacy issues are by-design

Copy link
Copy Markdown
Collaborator

Please fix CodeFactor issues.

Comment thread assets/files.wxs

Copy link
Copy Markdown
Member Author

PoshChan-Bot (@PoshChan) please retry static

Copy link
Copy Markdown
Collaborator

Steve Lee (@SteveL-MSFT), successfully started retry of PowerShell-CI-static-analysis

@@ -0,0 +1,386 @@
// Copyright (c) Microsoft Corporation. All rights reserved.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation.

@@ -0,0 +1,45 @@
# Copyright (c) Microsoft Corporation. All rights reserved.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
# Copyright (c) Microsoft Corporation. All rights reserved.
# Copyright (c) Microsoft Corporation.

Travis Plunk (TravisEz13) merged commit b74a26b into PowerShell:master Nov 4, 2019
Steve Lee (SteveL-MSFT) deleted the clipboard-cmdlets branch November 4, 2019 19:49
Paul Higinbotham (PaulHigin) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Nov 19, 2019

Copy link
Copy Markdown

🎉v7.0.0-preview.6 has been released which incorporates this pull request.:tada:

Handy links:

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj/PowerShell that referenced this pull request Aug 6, 2026
…10340)


Co-Authored-By: Ilya <darpa@yandex.ru>



Co-Authored-By: Ilya <darpa@yandex.ru>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log Committee-Reviewed PS-Committee has reviewed this and made a decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set-Clipboard in PowerShell Core on Windows Results in Throwing CommandNotFoundException

7 participants


Back | FazBrowse Home | New Git URL