-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmbtiles.go
47 lines (34 loc) · 903 Bytes
/
mbtiles.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
//go:build mbtiles
package show
import (
"context"
"fmt"
"os"
mbtiles "github.com/sfomuseum/go-mbtiles-show"
)
type MbtilesCommand struct {
Command
}
func init() {
ctx := context.Background()
RegisterCommand(ctx, "mbtiles", NewMbtilesCommand)
}
func NewMbtilesCommand(ctx context.Context, cmd string) (Command, error) {
c := &MbtilesCommand{}
return c, nil
}
func (c *MbtilesCommand) Run(ctx context.Context, args []string) error {
fs := mbtiles.DefaultFlagSet()
fs.Usage = func() {
fmt.Fprintf(os.Stderr, "Command-line tool for serving MBTiles tiles from an on-demand web server.\n")
fmt.Fprintf(os.Stderr, "Usage:\n\t%s mbtiles [options]\n", os.Args[0])
fmt.Fprintf(os.Stderr, "Valid options are:\n")
fs.PrintDefaults()
}
fs.Parse(args)
opts, err := mbtiles.RunOptionsFromFlagSet(ctx, fs)
if err != nil {
return err
}
return mbtiles.RunWithOptions(ctx, opts)
}