fix(pgcli): Fix error when initializing pgcli command#31
fix(pgcli): Fix error when initializing pgcli command#31rgoomar wants to merge 1 commit intorender-oss:mainfrom
Conversation
|
Looks like there's this error happening with the |
|
|
||
| if cmd.ArgsLenAtDash() == 0 { | ||
| input.PostgresIDOrName = "" | ||
| input.Tool = views.PGCLI |
There was a problem hiding this comment.
We don't need to set the tool here as this is defined inside InteractivePGCLIView right ?
|
We should keep the ParseCommand invocation somehow as it does sanity checking as well. With this change, i get a SIGSEGV when i pass -o to render pgcli instead of an error saying interactive mode is not supported for pgcli. I think pgcli itself also supports few non interactive options like -l and --ping. Since render pgcli integration does not yet support that, one way could be to extend render pgcli as well with the command flag just like psql. That would be decent code churn though. A mitigation idea can be to try and ignore the error when retrieving a field by adding an optional tag to the Let me know what you think. I can take a stab at changes I am suggesting as well. |
Summary
Fix
render pgclifailing withError: flag accessed but not defined: commandby bypassingParseCommandfor pgcli's arg parsing. This gets it into a working state.Motivation
render pgcliis broken — any invocation hits the error becauseParseCommandreflects over allclistruct tags onPSQLInput, includingCommand(taggedcli:"command"), which maps to a--commandflag that onlypsqlregisters. pgcli is interactive-only and doesn't need that flag.How to verify
render pgcli --help— should show help without errorrender pgcli— should launch interactive database selectionrender pgcli <postgres-id-or-name>— should connect directlyrender pgcli <postgres-id-or-name> -- --some-pgcli-flag— should pass extra args throughrender psql— should still work as before (no regression)I ran all of these locally with
Release notes