From b96f72d63641c8dcfe5e142ecd5d6c9f9a7d5778 Mon Sep 17 00:00:00 2001 From: "Joe Richey joerichey@google.com" Date: Fri, 6 Oct 2017 14:25:07 -0700 Subject: ext4: start refactor --- cmd/fscrypt/strings.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'cmd/fscrypt/strings.go') 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) } -- cgit v1.2.3