jonathanbossenger / wp-local-env

Cross OS WordPress local development environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test/tweak Linux support

jonathanbossenger opened this issue · comments

Mostly, this should already work on a Linux desktop, but it needs to be tested.

We will test with Ubuntu only for now.

Replace the section that relies on osascript on the Mac and use Python on Linux

INSTANCE_DATA=$( multipass info --format json wp-local-env )
read -r -d '' JXA <<EOF
function run() {
	var info = JSON.parse(\`$INSTANCE_DATA\`);
	return info.info["wp-local-env"].ipv4;
}
EOF
INSTANCE_IP=$( osascript -l 'JavaScript' <<< "${JXA}" )

See also : https://stackoverflow.com/questions/1955505/parsing-json-with-unix-tools