Centralize output schema names in schema package
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"gitea.maximumdirect.net/eric/seriatim/schema"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -27,9 +29,9 @@ const (
|
||||
WordRunReorderWindowEnv = "SERIATIM_OVERLAP_WORD_RUN_REORDER_WINDOW"
|
||||
BackchannelMaxDurationEnv = "SERIATIM_BACKCHANNEL_MAX_DURATION"
|
||||
FillerMaxDurationEnv = "SERIATIM_FILLER_MAX_DURATION"
|
||||
OutputSchemaMinimal = "seriatim-minimal"
|
||||
OutputSchemaIntermediate = "seriatim-intermediate"
|
||||
OutputSchemaFull = "seriatim-full"
|
||||
OutputSchemaMinimal = schema.OutputSchemaMinimal
|
||||
OutputSchemaIntermediate = schema.OutputSchemaIntermediate
|
||||
OutputSchemaFull = schema.OutputSchemaFull
|
||||
)
|
||||
|
||||
// MergeOptions captures raw CLI option values before validation.
|
||||
@@ -332,12 +334,12 @@ func parseModuleList(value string) ([]string, error) {
|
||||
}
|
||||
|
||||
func validateOutputSchema(value string) error {
|
||||
switch value {
|
||||
case OutputSchemaMinimal, OutputSchemaIntermediate, OutputSchemaFull:
|
||||
if schema.ValidOutputSchemaName(value) {
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("--output-schema must be one of %q, %q, or %q", OutputSchemaMinimal, OutputSchemaIntermediate, OutputSchemaFull)
|
||||
}
|
||||
|
||||
names := schema.OutputSchemaNames()
|
||||
return fmt.Errorf("--output-schema must be one of %q, %q, or %q", names[0], names[1], names[2])
|
||||
}
|
||||
|
||||
func resolveOutputSchema(value string) (string, error) {
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
SchemaMinimal = "seriatim-minimal"
|
||||
SchemaIntermediate = "seriatim-intermediate"
|
||||
SchemaFull = "seriatim-full"
|
||||
SchemaMinimal = schema.OutputSchemaMinimal
|
||||
SchemaIntermediate = schema.OutputSchemaIntermediate
|
||||
SchemaFull = schema.OutputSchemaFull
|
||||
)
|
||||
|
||||
// Artifact stores a parsed seriatim output artifact of one supported schema.
|
||||
|
||||
Reference in New Issue
Block a user