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"



Reply via email to