aaemnnosttv / wp-cli-login-command

Log in to WordPress with secure passwordless magic links.
https://aaemnnost.tv/wp-cli-commands/login/
MIT License
294 stars 47 forks source link

Customize --launch browser #23

Closed Log1x closed 6 years ago

Log1x commented 6 years ago

Does there happen to be a way to configure the --launch browser? Right now, it attempts to use xdg-open to launch www-browser on my Windows 10's Linux Subsystem but I'd rather it just use firefox.exe or detect an environment variable of what my default browser executable is.

Error: /usr/bin/xdg-open: 771: /usr/bin/xdg-open: www-browser: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: links2: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: elinks: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: links: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: lynx: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: w3m: not found
aaemnnosttv commented 6 years ago

You can set the WP_CLI_LOGIN_LAUNCH_WITH environment variable to override the binary used to launch the URL :)

Log1x commented 6 years ago

Thanks!

export WP_CLI_LOGIN_LAUNCH_WITH="/mnt/c/Program\ Files/Mozilla\ Firefox/firefox.exe" did the trick. sh wasn't able to find firefox.exe in my PATH but using the full directory worked despite being a little ugly.

sh seems to return a blank Error: for whatever reason but it works nonetheless. :smile:

Screenshot