klyn.code.LanguageRegistry.profileForPath
method
public static profileForPath(filePath as String, firstLine as String = "") as LanguageProfile
Description

Resolves a LanguageProfile from a file path, filename, or optional first-line shebang (#!).

Parameters
ParameterDescription
filePathFile path or filename (e.g. "src/Main.kn", "Makefile", "queries.sql").
firstLineOptional first line of the file for #! shebang inspection.
Returns

Resolved LanguageProfile.

Example
import klyn.code

assert LanguageRegistry.profileForPath("lib/klyn/String.kn").id == "klyn"
assert LanguageRegistry.profileForPath("schema.sql").id == "sql"
assert LanguageRegistry.profileForPath("README.md").id == "markdown"