diff --git a/plugins/copilot/copilot.go b/plugins/copilot/copilot.go index b8ef73320..51b236285 100644 --- a/plugins/copilot/copilot.go +++ b/plugins/copilot/copilot.go @@ -14,7 +14,6 @@ func CopilotCLI() schema.Executable { DocsURL: sdk.URL("https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-command-reference"), NeedsAuth: needsauth.IfAll( needsauth.NotForHelpOrVersion(), - needsauth.NotWithoutArgs(), needsauth.NotForExactArgs("login"), needsauth.NotForExactArgs("version"), needsauth.NotWhenContainsArgs("completion"), diff --git a/plugins/copilot/copilot_test.go b/plugins/copilot/copilot_test.go new file mode 100644 index 000000000..35defd727 --- /dev/null +++ b/plugins/copilot/copilot_test.go @@ -0,0 +1,32 @@ +package copilot + +import ( + "testing" + + "github.com/1Password/shell-plugins/sdk/plugintest" +) + +func TestCopilotCLINeedsAuth(t *testing.T) { + plugintest.TestNeedsAuth(t, CopilotCLI().NeedsAuth, map[string]plugintest.NeedsAuthCase{ + "interactive session": { + Args: []string{}, + ExpectedNeedsAuth: true, + }, + "agent invocation": { + Args: []string{"--agent", "blub"}, + ExpectedNeedsAuth: true, + }, + "login": { + Args: []string{"login"}, + ExpectedNeedsAuth: false, + }, + "version": { + Args: []string{"version"}, + ExpectedNeedsAuth: false, + }, + "completion": { + Args: []string{"completion", "bash"}, + ExpectedNeedsAuth: false, + }, + }) +}