1Password / shell-plugins

Seamless authentication for every tool in your terminal.
https://developer.1password.com/docs/cli/shell-plugins/
MIT License
519 stars 170 forks source link

Prepend arg for defaults-file #408

Open nr-dbuckwalter opened 10 months ago

nr-dbuckwalter commented 10 months ago

Overview

The mysql CLI depends on the --defaults-file=foo argument being the very first argument. This change provides a new 'PrependArgs' method and uses it for the mysql plugin.

From the mysql CLI help text:

The following groups are read: mysql client
The following options may be given as the first argument:
--print-defaults        Print the program argument list and exit.
--no-defaults           Don't read default options from any option file,
                        except for login file.
--defaults-file=#       Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.
--defaults-group-suffix=#
                        Also read groups with concat(group, suffix)
--login-path=#          Read this path from the login file.

Type of change

Related Issue(s)

How To Test

Build the plugin locally and run op plugin run mysql -- --host=foo using a credential with no host field. Before this PR, it results in the error: mysql: [ERROR] unknown variable 'defaults-file=... because the MySQL treats unknown arguments in the form --variable-name=foo as MySQL configuration variable. After the PR, additional command-line arguments are appended after --defaults-file that is injected by the mysql plugin.

Changelog

github-actions[bot] commented 10 months ago

⚠️ This PR contains unsigned commits. To get your PR merged, please sign those commits (git commit -S --amend --no-edit) and force push them to this branch (git push --force-with-lease).

If you're new to commit signing, there are different ways to set it up:

Sign commits with gpg

Follow the steps below to set up commit signing with `gpg`: 1. [Generate a GPG key](https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key) 2. [Add the GPG key to your GitHub account](https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account) 3. [Configure `git` to use your GPG key for commit signing](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key#telling-git-about-your-gpg-key)
Sign commits with ssh-agent

Follow the steps below to set up commit signing with `ssh-agent`: 1. [Generate an SSH key and add it to `ssh-agent`](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) 2. [Add the SSH key to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account) 3. [Configure `git` to use your SSH key for commit signing](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key#telling-git-about-your-ssh-key)
Sign commits with 1Password

You can also sign commits using 1Password, which lets you sign commits with biometrics without the signing key leaving the local 1Password process. Learn how to [use 1Password to sign your commits](https://developer.1password.com/docs/ssh/git-commit-signing/). Watch the demo
nr-dbuckwalter commented 10 months ago

Added my GPG key to Github -- commits are signed

minaguib commented 7 months ago

Any chance to get this approved and released ? The plugin is otherwise broken for all but the simplest usecases.

nr-dbuckwalter commented 7 months ago

@AndyTitu can you help with getting a second approver? Any chance you could add a CODEOWNERS or some other mechanism to help find the right reviewers in the future?

minaguib commented 7 months ago

Any maintainers able to merge to get this officially into next 1password-cli release ?

francoisjacques commented 6 months ago

@SimonBarendse this seems ready to go. Can you provide guidance if there are any steps missing?

nr-dbuckwalter commented 2 months ago

@mrjones2014 I see you are a recent committer/merger -- can you approve and merge this please?