Flock::Cli::Naming
Name conversions between the CLI's identifiers and Crystal's conventions.
Constants
NAME_RE = /\A[A-Za-z][A-Za-z0-9_-]*\z/
A valid identifier for a project/component/system/etc.: starts with a letter, then
letters/digits/underscores/hyphens. This rejects empty names, leading digits (which would
produce an invalid Crystal type like module 2048), and — importantly — path separators
and .., so a name can never escape the project (see Commands::Destroy, Commands::New).
Instance methods
"player_health" / "player-health" / "PlayerHealth" -> "PlayerHealth" (a type name).
Relative path from directory from to to (both made absolute), for requires that
work regardless of where the project lives. e.g. ("/tmp/g/src", "/u/nw") -> "../../../u/nw".
"PlayerHealth" / "player-health" -> "player_health" (a file / method name).