Support for Non-English Characters in Option Descriptions within command.go
- Dominant language
- Go
- Stars
- 21
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
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:
```go
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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.