Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Jul 11, 2024
1 parent 5452950 commit 04d3d0d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions assets/fcitx5-curl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/zsh
set -eu

DEBUG="${DEBUG:-}"

if [[ $# -eq 0 || $# -eq 1 && ( "$1" == "-h" || "$1" == "--help" ) ]]; then
echo "Usage: fcitx5-curl path [curl options]"
echo "Example: fcitx5-curl /config/addon/rime/deploy -X POST -d '{}'"
Expand All @@ -22,24 +24,22 @@ TCP_PORT="${TCP_PORT:-32489}"

CURL_FLAGS=()

if [[ "$COMMUNICATION" == 'TCP' ]]
then
if [[ "$COMMUNICATION" == 'TCP' ]]; then
FCITX_BEAST_URL="http://127.0.0.1:$TCP_PORT$1"
else
CURL_FLAGS+=('--unix-socket' "$UDS_PATH")
FCITX_BEAST_URL="http://fcitx$1"
fi

shift
CURL_FLAGS+=$@
CURL_FLAGS+=($@)

if [ -n "DEBUG" ]
then
if [[ -n "$DEBUG" ]]; then
echo "COMMUNICATION=$COMMUNICATION"
echo "UDS_PATH=$UDS_PATH"
echo "TCP_PORT=$TCP_PORT"
echo "FCITX_BEAST_URL=$FCITX_BEAST_URL"
echo "CURL_FLAGS=$CURL_FLAGS"
fi
curl $CURL_FLAGS "$FCITX_BEAST_URL"

curl $CURL_FLAGS "$FCITX_BEAST_URL"

0 comments on commit 04d3d0d

Please sign in to comment.