Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cosign autocompletion #873

Merged
merged 1 commit into from
Mar 24, 2022
Merged

Conversation

developer-guy
Copy link
Contributor

@developer-guy developer-guy commented Jan 26, 2022

Signed-off-by: Batuhan Apaydın [email protected]

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

feature

What is the current behavior? (You can also link to an open issue here)

no support for cosign

What is the new behavior (if this is a feature change)?

will add cosign CLI autocompletion support

Additional info:

https://github.com/sigstore/cosign
sigstore/cosign#1360

@withfig-bot
Copy link
Collaborator

withfig-bot commented Jan 26, 2022

Overview

src/cosign.ts:

Info:

URLs:

  • https://fulcio.sigstore.dev
  • https://oauth2.sigstore.dev/auth
  • https://rekor.sigstore.dev
  • https://token.actions.githubusercontent.com
  • https://rekor.sigstore.dev
  • https://token.actions.githubusercontent.com
  • https://rekor.sigstore.dev
  • https://accounts.google.com
  • https://fulcio.sigstore.dev
  • https://oauth2.sigstore.dev/auth
  • https://rekor.sigstore.dev
  • https://fulcio.sigstore.dev
  • https://oauth2.sigstore.dev/auth
  • https://rekor.sigstore.dev
  • https://fulcio.sigstore.dev
  • https://oauth2.sigstore.dev/auth
  • https://rekor.sigstore.dev
  • https://token.actions.githubusercontent.com
  • https://rekor.sigstore.dev
  • https://token.actions.githubusercontent.com
  • https://rekor.sigstore.dev
  • https://token.actions.githubusercontent.com
  • https://rekor.sigstore.dev
  • https://token.actions.githubusercontent.com
  • https://rekor.sigstore.dev
  • https://token.actions.githubusercontent.com
  • https://rekor.sigstore.dev
  • https://accounts.google.com
  • https://fulcio.sigstore.dev
  • https://oauth2.sigstore.dev/auth
  • https://rekor.sigstore.dev

@withfig-bot
Copy link
Collaborator

Hello @developer-guy,
thank you very much for creating a Pull Request!
Here is a small checklist to get this PR merged as quickly as possible:

  • Do all subcommands / options which take arguments include the args property (args: {})?
  • Are all options modular? E.g. -a -u -x instead of -aux
  • Have all other checks passed?

Please add a 👍 as a reaction to this comment to show that you read this.

Copy link
Member

@mschrage mschrage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked too closely at this but overall it looks good. One thing to be aware of is that since cosign is implemented using cobra, it should be possible to autogenerate a completion spec.

Check out this guide for more details.

@developer-guy
Copy link
Contributor Author

I haven't looked too closely at this but overall it looks good. One thing to be aware of is that since cosign is implemented using cobra, it should be possible to autogenerate a completion spec.

Check out this guide for more details.

Yep, I've already opened a PR to cosign side 👇
sigstore/cosign#1360

@developer-guy
Copy link
Contributor Author

kindly ping 🙋🏻‍♂️

@fedeci
Copy link
Contributor

fedeci commented Feb 1, 2022

I imagine this has been generated by adding the cobra integration locally, right?

Copy link
Contributor

@fedeci fedeci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty sure this has been generated via the cobra integration. There are a lot of lines here and it would be quite long to review all the possible templates/suggestions for the args both for us and for you.
What we could do to add useful props quickly is to perform a strategic search of some keywords in the spec.
e.g.:

  • options that has output,input,path in the name will likely accept filepaths
  • /\([a-zA-Z0-9]+\|/g this regex will instead highlight all options that require a suggestions field)

name: "--output-file",
description: "Log output to a file",
displayName: "output-file",
args: { name: "output-file" },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This accepts a filepaths template.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty sure this has been generated via the cobra integration. There are a lot of lines here and it would be quite long to review all the possible templates/suggestions for the args both for us and for you. What we could do to add useful props quickly is to perform a strategic search of some keywords in the spec. e.g.:

  • options that has output,input,path in the name will likely accept filepaths
  • /\([a-zA-Z0-9]+\|/g this regex will instead highlight all options that require a suggestions field)

/cc @developer-guy this can be done in another PR

},
{
name: "--type",
description: "Type of sbom (spdx|cyclonedx|syft)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These suggestions can be mentioned in the suggestions prop of arg.

Signed-off-by: Batuhan Apaydın <[email protected]>
Copy link
Contributor

@fedeci fedeci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@fedeci fedeci changed the title feat: cosign autocompletion feat: add cosign autocompletion Mar 24, 2022
@fedeci fedeci merged commit 19f1636 into withfig:master Mar 24, 2022
@developer-guy
Copy link
Contributor Author

thanks for merging @fedeci

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants