Skip to content
New issue

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

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

Already on GitHub? # to your account

trimming the output #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

trimming the output #9

wants to merge 1 commit into from

Conversation

glaslos
Copy link

@glaslos glaslos commented Apr 4, 2023

Addressing #8
Benchmark suffers by about 12% iterations on my machine.

Copy link
Owner

@mozillazg mozillazg left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! I added some comments.

@@ -22,7 +27,7 @@ func main() {

textSlice := flag.Args()
stdin := []byte{}
if !isatty.IsTerminal(os.Stdin.Fd()) {
if !isTerminal(os.Stdin.Fd()) {
Copy link
Owner

Choose a reason for hiding this comment

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

we need github.com/mattn/go-isatty to support mac os and windows.

@@ -15,7 +15,7 @@ func Version() string {
// Unidecode implements transliterate Unicode text into plain 7-bit ASCII.
// e.g. Unidecode("kožušček") => "kozuscek"
func Unidecode(s string) string {
return unidecode(s)
return strings.Trim(unidecode(s), " ")
Copy link
Owner

Choose a reason for hiding this comment

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

What happens when the s is kožušček ? Does it return an unexpected kozuscek?

IMHO, letting the caller do the trim work is more simple.

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

Successfully merging this pull request may close these issues.

2 participants