package main type crystal struct { language } func (c *crystal) string() string { segmentTemplate := c.language.props.getString(SegmentTemplate, "{{ if .Error }}{{ .Error }}{{ else }}{{ .Full }}{{ end }}") return c.language.string(segmentTemplate, c) } func (c *crystal) init(props Properties, env Environment) { c.language = language{ env: env, props: props, extensions: []string{"*.cr", "shard.yml"}, commands: []*cmd{ { executable: "crystal", args: []string{"--version"}, regex: `Crystal (?P((?P[0-9]+).(?P[0-9]+).(?P[0-9]+)))`, }, }, versionURLTemplate: "https://github.com/crystal-lang/crystal/releases/tag/{{ .Full }}", } } func (c *crystal) enabled() bool { return c.language.enabled() }