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

Derive field name in make new-plugin more intelligently #72

Merged
merged 1 commit into from Dec 12, 2022

Conversation

florisvdg
Copy link
Member

@florisvdg florisvdg commented Dec 6, 2022

In make new-plugin, instead of always using the last word of the credential name as the field name, also take the second to last word if the resulting field name is not too lengthy.

For example:

"Personal Access Token" => "Token"
"Secret Key" => "Key"
"API Key" => "API Key"
"Personal API Token" => "Token"

The 7 value is arbitrary and can be changed later if we feel like it.

This new field name is also used as the env var name:
Previously, we'd derive GITHUB_PERSONAL_ACCESS_TOKEN, but now it would be GITHUB_TOKEN.

Instead of always using the last word of the credential name as the field name, also take the second to last word if the result is not too lengthy (e.g. API Key).
Copy link
Contributor

@AndyTitu AndyTitu left a comment

Choose a reason for hiding this comment

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

Lgtm. Played around with the split functionality and it works as expected

cmd/contrib/main.go Show resolved Hide resolved
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.

None yet

4 participants