mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-26 01:22:51 +00:00
Some checks failed
SyncVendor / sync vendor (push) Has been cancelled
Co-authored-by: ks-ci-bot <ci-bot@kubesphere.io> Signed-off-by: joyceliu <joyceliu@yunify.com>
27 lines
750 B
Go
27 lines
750 B
Go
package flect
|
|
|
|
var singularRules = []rule{}
|
|
|
|
// AddSingular adds a rule that will replace the given suffix with the replacement suffix.
|
|
// The name is confusing. This function will be deprecated in the next release.
|
|
func AddSingular(ext string, repl string) {
|
|
InsertSingularRule(ext, repl)
|
|
}
|
|
|
|
// InsertSingularRule inserts a rule that will replace the given suffix with
|
|
// the repl(acement) at the beginning of the list of the singularize rules.
|
|
func InsertSingularRule(suffix, repl string) {
|
|
singularMoot.Lock()
|
|
defer singularMoot.Unlock()
|
|
|
|
singularRules = append([]rule{{
|
|
suffix: suffix,
|
|
fn: simpleRuleFunc(suffix, repl),
|
|
}}, singularRules...)
|
|
|
|
singularRules = append([]rule{{
|
|
suffix: repl,
|
|
fn: noop,
|
|
}}, singularRules...)
|
|
}
|