shell-plugins
shell-plugins copied to clipboard
1Password mysql shell plugin breaks additional CLI arguments
Platform or tool
mysql
Desired or expected behavior
Invoking mysql additional arguments
should work as if invoking native mysql
binary
Current behavior
Supplying additional arguments while using the 1Password mysql shell plugin integration returns error:
mysql: [ERROR] unknown variable 'defaults-file=/var/folders/hp/7hxtb9_968d3vj4q13z28vjc0000gn/T/1PasswordShellPlugins-413974828/my.cnf'.
Relevant log output
I investigated a bit, and given an invocation like mysql dbname
The plugin prepares the temporary file and appends it to the CLI arguments like so:
/opt/homebrew/opt/mysql-client/bin/mysql dbname --defaults-file=/var/folders/hp/7hxtb9_968d3vj4q13z28vjc0000gn/T/1PasswordShellPlugins-413974828/my.cnf
mysql: [ERROR] unknown variable 'defaults-file=/var/folders/hp/7hxtb9_968d3vj4q13z28vjc0000gn/T/1PasswordShellPlugins-413974828/my.cnf'.
It appears however that the position matters to the underlying mysql
binary, and arguments like --defaults-file
need to come before additional arguments (like dbname
or -e foo.sql
or -A
etc...)
This order works:
/opt/homebrew/opt/mysql-client/bin/mysql --defaults-file=/var/folders/hp/7hxtb9_968d3vj4q13z28vjc0000gn/T/1PasswordShellPlugins-413974828/my.cnf dbname
op CLI version
2.23.0