Closed thirota closed 1 month ago
I'm on the same version of ansiweather
and also on Sonoma and I don't have any issues. I installed ansiweather
via homebrew. I tried your config file also:
% cat ~/.ansiweatherrc
location:Tokyo
and it worked for me.
Weather in Tokyo: 28 °C - UVI: 7.69 - Wind: 3.6 m/s WSW - Humidity: 85% - Pressure: 1013 hPa
@chicks-net Thanks for your comment.
I apologize for the lack of explanation in the Environment section. I have an environment variable on my MacBook Air:
% env | grep GREP
GREP_OPTIONS=--color=always
On my other MacBook Pro, the ansiweather script works as expected, and it does not have GREP_OPTIONS
.
This issue appears to depend on my local environment settings.
Thanks for explaining the GREP_OPTIONS
issue again. I missed that variable being set in the original issue.
It might be good for ansiweather to internally set GREP_OPTIONS
to a value that isn't problematic. It wouldn't override your usage of that option in the interactive shell.
Summary
Ansiweather script fails when using the config file.
Environment
Expected behavior
Can fetch weather data.
Actual behavior
Cannot fetch weather data.
Root cause
The location variable includes invalid text because the grep command marks up the matching text and returns the escape sequences.
Workaround
ret=$(grep "--color=never" "^$1:" "$config_file" | cut -d: -f2-) fi
I would like to create a pull request, but I'm not sure whether the color option is available for every linux distribution. So, I will report this problem as an issue.
Thanks.
Taka