# Pastebin w1yhM4Nc .tell antononcube gist for xclip mockup for Debian: #== From: Max Nikulin #== 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: debian-user@lists.debian.org #== X-Mailing-List: archive/latest/803232 #== X-Loop: debian-user@lists.debian.org #== List-Id: #== List-URL: #== 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"