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

Support for Non-English Characters in Option Descriptions within command.go #11

Open
b7q-test opened this issue Mar 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@b7q-test
Copy link

I'm working with the serpent library, particularly focusing on handling command-line options as defined within the command.go file of your project. I've encountered an issue that arises from the enforcement of rules concerning the format of option descriptions:

if opt.Description != "" {
    // Enforce that description uses sentence form.
    if unicode.IsLower(rune(opt.Description[0])) {
        merr = errors.Join(merr, xerrors.Errorf("option %q description should start with a capital letter", opt.Name))
    }
    if !strings.HasSuffix(opt.Description, ".") {
        merr = errors.Join(merr, xerrors.Errorf("option %q description should end with a period", opt.Name))
    }
}
Located in command.go, this code enforces that each option description starts with a capital letter and ends with a period. This rule aligns well with descriptions written in English. However, it becomes problematic for descriptions in non-English languages, especially for those that utilize non-Latin scripts (such as Chinese, Japanese, Arabic, etc.).

The validation errors occur because the current implementation assumes the use of English sentence structure and punctuation, which does not universally apply to all languages.
@coder-labeler coder-labeler bot added the bug Something isn't working label Mar 23, 2024
@ammario
Copy link
Member

ammario commented Apr 2, 2024

Hey, this is a valid problem and a vestige of the library's past presence within coder/coder. We should move this linting logic over there and be unopinionated here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants