esp-rs / espflash

Serial flasher utility for Espressif SoCs and modules based on esptool.py
Apache License 2.0
455 stars 110 forks source link

Using environment variable `ESPFLASH_PORT` does not provide value for `--port` arg #648

Closed jnross closed 2 weeks ago

jnross commented 2 weeks ago

I'm not sure if this is a bug in clap, or this projects use of it. Or perhaps it's a bug that only occurs on macOS. But when I set the ESPFLASH_PORT environment variable, it doesn't provide that value for the --port command.

I found that if I change the env value for this arg to "ESPFLASHPORT", it starts working. The underscore is causing a problem somehow.

jnross commented 2 weeks ago

My mistake, this was operator error. I was trying to do something tricky with globs in zsh. echo was telling me what I wanted to see, but that wasn't telling the whole truth. I got this sorted out.

jnross commented 2 weeks ago

If anyone's curious, I got this to work as I want by adding the following to my .zprofile

TEMP_ESPFLASH_PORT=(/dev/cu.usbmodem*)
export ESPFLASH_PORT=$~TEMP_ESPFLASH_PORT