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

Customize CLI command names #7276

Open
sagikazarmark opened this issue May 3, 2024 · 1 comment
Open

Customize CLI command names #7276

sagikazarmark opened this issue May 3, 2024 · 1 comment
Labels

Comments

@sagikazarmark
Copy link
Contributor

What are you trying to do?

Allow customizing how function names are translated into commands.

For example:

// +command=e2e
func (m *Ci) E2e() {
    // ...
}

Why is this important to you?

Function names are often translated to weird commands. For example E2e becomes e-2-e.

How are you currently working around this?

I call my end-to-end test function Etoe. 🙈

@helderco
Copy link
Contributor

Rather than customizing the CLI name, we need to enable customizing the name in the API. Python and Typescript do that through the decorators:

This would add paritity in Go, but probably with +name instead of +command.

However, if doing the same as Py or TS, does it lead to the same issue of e2e translating to e-2-e? I'll need to check where that's happening because we use two different Go utils in different places. One of those (I suspect strcase) is breaking numbers instead of just changes in casing.

The API uses the same naming convention as TypeScript (camelCase), which is similar to Go (PascalCase), in that both use casing to split words. Python's much simpler to break words into (snake_case), same as the CLI (kebab-case). So maybe using the CLI's convention is the more neutral and consistent way to override the names in all SDKs.

Think about acronyms. For example SSH translates to s-s-h unless you have a list of common acronyms (like we do). But overriding to +name=ssh would make it less ambiguous or easier to know how to convert consistently.

@helderco helderco added the Go SDK label May 14, 2024 — with Linear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants