Created
September 11, 2023 13:44
-
-
Save tbrowder/b80451afe3a91cf90e2dab183f4758ff to your computer and use it in GitHub Desktop.
An xclip mockup forDebian OS
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
#== From: Max Nikulin <[email protected]> | |
#== Subject: Re: xclip - how to use without a graphics display for testing on Github workflows | |
#== Date: Sun, 10 Sep 2023 23:48:28 +0700 | |
#== Content-Type: text/plain; charset=UTF-8; format=flowed | |
#== Content-Transfer-Encoding: 7bit | |
#== Resent-From: [email protected] | |
#== X-Mailing-List: <[email protected]> archive/latest/803232 | |
#== X-Loop: [email protected] | |
#== List-Id: <debian-user.lists.debian.org> | |
#== List-URL: <https://lists.debian.org/debian-user/> | |
#== Resent-Date: Sun, 10 Sep 2023 16:49:01 +0000 (UTC) | |
# | |
# On 10/09/2023 16:44, Tom Browder wrote: | |
# > On Sat, Sep 9, 2023 at 21:06 Max Nikulin wrote: | |
# > | |
# >> You can create a mock-up and use it instead of real xclip binary. | |
# > | |
# > Sounds interesting, Max, can you show the code? | |
# | |
# Unless you need to test subtle issues like | |
# | |
# https://github.com/astrand/xclip/issues/20 | |
# "Not closing stdout when setting clipboard from stdin" | |
# | |
# faced by e.g. tmux users, something simple should be enough: | |
#!/bin/sh -eu | |
: "${XCLIP_MOCK_FILE:=$HOME/.xclip-mock}" | |
while [ $# -gt 0 ]; do | |
case "$1" in | |
-i|-in) | |
;; | |
-o|--out) exec cat -- "$XCLIP_MOCK_FILE" | |
;; | |
-selection|-target) shift | |
;; | |
*) # FIXME xclip treats all unknown options at any position as files | |
break | |
;; | |
esac | |
shift | |
done | |
exec cat -- "$@" >"$XCLIP_MOCK_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment