summaryrefslogtreecommitdiff
path: root/cli/src/main/scala/com/rockymadden/stringmetric/cli/phonetic/nysiisalgorithm.scala
blob: bef2bc56dca38e767d8031d366376a71e18f4d4c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package com.rockymadden.stringmetric.cli.phonetic

import com.rockymadden.stringmetric.cli._
import com.rockymadden.stringmetric.phonetic.NysiisAlgorithm

case object nysiisalgorithm extends Command(
	(opts) =>
		"Returns the phonetic representation of the passed string, per the NYSIIS algorithm." + Ls + Ls +
		"Syntax:" + Ls +
		Tab + "nysiisalgorithm [Options] string..." + Ls + Ls +
		"Options:" + Ls +
		Tab + "-h, --help" + Ls +
		Tab + Tab + "Outputs description, syntax, and options.",
	(opts) => opts.contains('dashless) && (opts('dashless): Array[String]).length == 1,
	(opts) => NysiisAlgorithm.compute(opts('dashless)).getOrElse("not computable")
)