mycroforge/MycroForge.CLI/Commands/FullyQualifiedName.cs

29 lines
683 B
C#

using Humanizer;
namespace MycroForge.CLI.Commands;
public class FullyQualifiedName
{
public string Path { get; }
public string PascalizedName { get; }
public string SnakeCasedName { get; }
public bool HasPath => Path.Length > 0;
public FullyQualifiedName(string name)
{
var path = string.Empty;
if (name.Split(':').Select(s => s.Trim()).ToArray() is { Length: 2 } fullName)
{
path = fullName[0];
name = fullName[1];
}
Path = path;
PascalizedName = name.Pascalize();
SnakeCasedName = name.Underscore().ToLower();
}
}