diff options
| author | Joe Richey joerichey@google.com <joerichey@google.com> | 2017-10-06 14:25:07 -0700 |
|---|---|---|
| committer | Joseph Richey <joerichey94@gmail.com> | 2017-10-19 02:22:23 -0700 |
| commit | b96f72d63641c8dcfe5e142ecd5d6c9f9a7d5778 (patch) | |
| tree | bc15a81c4af5cf75dbf3aa6ed7c9d21418b5226f /cmd/fscrypt/strings.go | |
| parent | 7d16a9fb37b8a6204d76f187444330b8faae4e4e (diff) | |
ext4: start refactor
Diffstat (limited to 'cmd/fscrypt/strings.go')
| -rw-r--r-- | cmd/fscrypt/strings.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cmd/fscrypt/strings.go b/cmd/fscrypt/strings.go index fb79c38..e90abe1 100644 --- a/cmd/fscrypt/strings.go +++ b/cmd/fscrypt/strings.go @@ -122,12 +122,9 @@ Options: {{end}}` ) -// Add words to this map to have pluralize support them. +// Add words to this map if pluralization does not just involve adding an s. var plurals = map[string]string{ - "argument": "arguments", - "filesystem": "filesystems", - "protector": "protectors", - "policy": "policies", + "policy": "policies", } // pluralize prints our the correct pluralization of a work along with the @@ -135,7 +132,11 @@ var plurals = map[string]string{ // pluralize(2, "policy") = "2 policies" func pluralize(count int, word string) string { if count != 1 { - word = plurals[word] + if plural, ok := plurals[word]; ok { + word = plural + } else { + word += "s" + } } return fmt.Sprintf("%d %s", count, word) } |