feat: added keyword codec (partially works)
This commit is contained in:
@@ -72,6 +72,12 @@ func parseShortTemplate(input string) (Block, error) {
|
||||
switch strings.TrimSpace(option) {
|
||||
case "number":
|
||||
block.Codec = CodecNumber
|
||||
case "text":
|
||||
block.Codec = CodecText
|
||||
case "hashtags":
|
||||
block.Codec = CodecHashtags
|
||||
default:
|
||||
return block, fmt.Errorf("unknown codec option: %s", option)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,11 +6,12 @@ import "fmt"
|
||||
type CodecType string
|
||||
|
||||
const (
|
||||
CodecText CodecType = "text"
|
||||
CodecNumber CodecType = "number"
|
||||
CodecYaml CodecType = "yaml"
|
||||
CodecList CodecType = "list"
|
||||
CodecConst CodecType = "const"
|
||||
CodecText CodecType = "text"
|
||||
CodecNumber CodecType = "number"
|
||||
CodecYaml CodecType = "yaml"
|
||||
CodecList CodecType = "list"
|
||||
CodecConst CodecType = "const"
|
||||
CodecHashtags CodecType = "hashtags"
|
||||
)
|
||||
|
||||
func parseCodecType(input string) (CodecType, error) {
|
||||
@@ -25,6 +26,8 @@ func parseCodecType(input string) (CodecType, error) {
|
||||
return CodecText, nil
|
||||
case "const":
|
||||
return CodecConst, nil
|
||||
case "hashtags":
|
||||
return CodecHashtags, nil
|
||||
}
|
||||
return CodecText, fmt.Errorf("unknown codec: '%s'", input)
|
||||
}
|
||||
|
Reference in New Issue
Block a user