• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mlange-42 / modo / 12777767016

14 Jan 2025 10:46PM CUT coverage: 34.058% (+0.2%) from 33.894%
12777767016

Pull #39

github

web-flow
Merge 12e54bf0f into efc472466
Pull Request #39: Move the binary package to module root

0 of 60 new or added lines in 3 files covered. (0.0%)

282 of 828 relevant lines covered (34.06%)

2.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/format/formats.go
1
package format
2

3
import (
4
        "fmt"
5

6
        "github.com/mlange-42/modo/document"
7
)
8

9
type Format uint8
10

11
const (
12
        Plain Format = iota
13
        MdBook
14
        Hugo
15
)
16

NEW
17
func GetFormat(f string) (Format, error) {
×
18
        fm, ok := formats[f]
×
NEW
19
        if !ok {
×
NEW
20
                return Plain, fmt.Errorf("unknown format '%s'. See flag --format", f)
×
NEW
21
        }
×
NEW
22
        return fm, nil
×
23
}
24

25
var formats = map[string]Format{
26
        "":       Plain,
27
        "plain":  Plain,
28
        "mdbook": MdBook,
29
        "hugo":   Hugo,
30
}
31

32
var formatters = []document.Formatter{
33
        &PlainFormatter{},
34
        &MdBookFormatter{},
35
        &HugoFormatter{},
36
}
37

38
type Config struct {
39
        Format          Format
40
        CaseInsensitive bool
41
}
42

43
func GetFormatter(f Format) document.Formatter {
×
44
        return formatters[f]
×
45
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc