Skip to content

Commit

Permalink
to simplify PR, remove other shellcheck-driven changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mobilemind committed Jun 23, 2017
1 parent 2432dd6 commit afee21b
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions rmate
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,12 @@ function hostname_command(){
fi
}

# intent is to execute hostname command, so disable the warning
# shellcheck disable=SC2091
hostname=$($(hostname_command))

# default configuration
host=localhost
port=52698
eval home="$(builtin printf "~%q" "${SUDO_USER:-$LOGNAME}")"
eval home=$(builtin printf "~%q" "${SUDO_USER:-$LOGNAME}")

function load_config {
local rc_file=$1
Expand All @@ -79,10 +77,8 @@ function load_config {
fi
}

# "home" is from earlier eval so disable warning about unassigned reference
# shellcheck disable=SC2154
for i in "/etc/${0##*/}" $home/."${0##*/}/${0##*/}.rc" $home/."${0##*/}.rc"; do
load_config "$i"
load_config $i
done

host="${RMATE_HOST:-$host}"
Expand All @@ -101,8 +97,8 @@ force=false
# process command-line parameters
#
function showusage {
echo "usage: $(basename "$0") [arguments] file-path edit specified file
or: $(basename "$0") [arguments] - read text from stdin
echo "usage: $(basename $0) [arguments] file-path edit specified file
or: $(basename $0) [arguments] - read text from stdin
-H, --host HOST Connect to HOST. Use 'auto' to detect the host from
SSH. Defaults to $host.
Expand Down Expand Up @@ -296,8 +292,6 @@ function open_file {
fi

if [ "$filepath" != "-" ] && [ -f "$filepath" ]; then
# ls is used to get filesize, so skip warning about find
# shellcheck disable=SC2012
filesize=`ls -lLn "$realpath" | awk '{print $5}'`
echo "data: $filesize" 1>&3
cat "$realpath" 1>&3
Expand Down Expand Up @@ -389,8 +383,6 @@ function handle_connection {
#
exec 3<> /dev/tcp/$host/$port

# checking return value of exec here is clearer; skip warning
# shellcheck disable=SC2181
if [ $? -gt 0 ]; then
echo "Unable to connect to TextMate on $host:$port"
exit 1
Expand Down

0 comments on commit afee21b

Please sign in to comment.