nncli

NextCloud Notes Command Line Interface
git clone git://git.danielmoch.com/nncli.git
Log | Files | Refs | LICENSE

commit 1247b63818a22babf760c73a5397d5d950acec9b
parent 37f75550a596aae45685a0a5abaabfcbf13d2000
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Mon, 18 Nov 2019 05:44:13 -0500

clipboard: Silence calls to 'which'

Diffstat:
Mnncli/clipboard.py | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/nncli/clipboard.py b/nncli/clipboard.py @@ -2,7 +2,7 @@ """clipboard module""" import os import subprocess -from subprocess import CalledProcessError +from subprocess import CalledProcessError, DEVNULL class Clipboard: """Class implements copying note content to the clipboard""" @@ -14,19 +14,22 @@ def get_copy_command(): """Defines the copy command based on the contents of $PATH""" try: - subprocess.check_output(['which', 'xsel']) + subprocess.check_call(['which', 'xsel'], stdout=DEVNULL, + stderr=DEVNULL) return 'echo "%s" | xsel -ib' except CalledProcessError: pass try: - subprocess.check_output(['which', 'pbcopy']) + subprocess.check_call(['which', 'pbcopy'], stdout=DEVNULL, + stderr=DEVNULL) return 'echo "%s" | pbcopy' except CalledProcessError: pass try: - subprocess.check_output(['which', 'xclip']) + subprocess.check_call(['which', 'xclip'], stdout=DEVNULL, + stderr=DEVNULL) return 'echo "%s" | xclip -selection clipboard' except CalledProcessError: pass