Autocompletion breaks when app .env can't be parsed #652

Closed
opened 2024-12-03 16:52:17 +00:00 by simon · 1 comment
Member

If I have any unparseable statement in an .env file in my ~/abra/servers folder, autocompletion doesn't work at all for all the apps.

WARNING:dotenv.main:Python-dotenv could not parse statement starting at line 130
Example of such a statement: APP_SERVICE_CONFIGS="["/signal-data/registration.yaml"]"

My expectation is that autocompletion still works at least for all the other apps, if not even for the app with broken .env, too

If I have any unparseable statement in an `.env` file in my ~/abra/servers folder, autocompletion doesn't work at all for all the apps. `WARNING:dotenv.main:Python-dotenv could not parse statement starting at line 130` Example of such a statement: `APP_SERVICE_CONFIGS="["/signal-data/registration.yaml"]"` My expectation is that autocompletion still works at least for all the other apps, if not even for the app with broken .env, too
simon added the
bug
label 2024-12-03 16:52:17 +00:00
decentral1se added the
abra
label 2024-12-03 23:35:34 +00:00
Owner

I took a look at this.

Due to the way the lookup code works for apps / app envs, this can't be avoided in some cases. E.g. if we need to see what an env var value is and the parsing breaks. However, I was able to change the code to avoid parsing when doing <app> lookups, so that is more robust.

I also added a way to debug autocompletion when it is breaking and actually get the errors. It's a bit of a hack but if you do abra __complete app deploy foo[enter], then you'll get the autocomplete output or failure.

https://github.com/spf13/cobra/blob/main/site/content/completions/_index.md#debugging

I took a look at this. Due to the way the lookup code works for apps / app envs, this can't be avoided in some cases. E.g. if we need to see what an env var value is and the parsing breaks. However, I was able to change the code to avoid parsing when doing `<app>` lookups, so that is more robust. I also added a way to debug autocompletion when it is breaking and actually get the errors. It's a bit of a hack but if you do `abra __complete app deploy foo[enter]`, then you'll get the autocomplete output or failure. > https://github.com/spf13/cobra/blob/main/site/content/completions/_index.md#debugging
Sign in to join this conversation.
No description provided.