-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.go
51 lines (46 loc) · 1.38 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"os"
"github.com/monopole/mdrip/v2/internal/commands/generatetestdata"
"github.com/monopole/mdrip/v2/internal/commands/print"
"github.com/monopole/mdrip/v2/internal/commands/raw"
"github.com/monopole/mdrip/v2/internal/commands/serve"
"github.com/monopole/mdrip/v2/internal/commands/test"
"github.com/monopole/mdrip/v2/internal/commands/version"
"github.com/monopole/mdrip/v2/internal/loader"
"github.com/monopole/mdrip/v2/internal/parsren/usegold"
"github.com/monopole/mdrip/v2/internal/provenance"
"github.com/monopole/mdrip/v2/internal/utils"
"github.com/spf13/afero"
"github.com/spf13/cobra"
)
const (
shortHelp = "Extract and manipulate code blocks from a markdown tree."
)
func newCommand() *cobra.Command {
c := &cobra.Command{
Use: utils.PgmName + " {path}",
Short: shortHelp,
Long: shortHelp + " (" + provenance.GetProvenance().Version + ")",
}
ldr := loader.New(afero.NewOsFs())
p := usegold.NewGParser()
c.AddCommand(
print.NewCommand(ldr, p),
raw.NewCommand(),
serve.NewCommand(ldr, p),
test.NewCommand(ldr, p),
version.NewCommand(),
generatetestdata.NewCommand(),
// "tmux" websocket service disabled until a reasonable use case found.
// the concept works fine on localhost without a websocket.
// tmux.NewCommand(ldr),
)
return c
}
func main() {
if err := newCommand().Execute(); err != nil {
os.Exit(1)
}
os.Exit(0)
}