From 2664a871324f1f4013a9df9f6f6a0d4af139f6c4 Mon Sep 17 00:00:00 2001 From: Ruy Adorno Date: Thu, 19 Oct 2017 16:04:48 -0400 Subject: [PATCH] Fixes linux nc integration, fix #1 --- prettierme | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/prettierme b/prettierme index 6f656e9..67a5d79 100755 --- a/prettierme +++ b/prettierme @@ -75,6 +75,12 @@ if [ -z "$prettierddata" ]; then prettierdtoken=$(echo $prettierddata | cut -d ' ' -f 2) fi +if nc 2>&1 | grep -- -q >/dev/null; then + NC_OPTIONS="-q 0" +else + NC_OPTIONS="" +fi + # uses netcat to lint the file -echo "$prettierdtoken {\"cwd\":\"$PWD\",\"args\":[\"--write\", \"--local-only\", \"--pkg-conf\", \"$1\"]}" | nc 127.0.0.1 "$prettierdport" +echo "$prettierdtoken {\"cwd\":\"$PWD\",\"args\":[\"--write\", \"--local-only\", \"--pkg-conf\", \"$1\"]}" | nc $NC_OPTIONS 127.0.0.1 "$prettierdport"