-
Notifications
You must be signed in to change notification settings - Fork 0
/
rip.go
40 lines (35 loc) · 839 Bytes
/
rip.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
package main
import (
"errors"
cli "github.com/urfave/cli/v2"
)
func subcmdCfgRip() *cli.Command {
return &cli.Command{
Name: "rip",
Usage: "process MKV files from ripping",
Subcommands: []*cli.Command{
cmdCfgNew(),
cmdCfgFinish(),
cmdCfgDir(),
cmdCfgTmm(),
cmdCfgPush(),
cmdCfgStage(),
cmdCfgRipLs(),
},
}
}
// Returns toolPaths, toolState, a function to call to save updated tool state, and any error.
func ripCmdInit(c *cli.Context) (*toolPaths, *toolState, func() error, error) {
tp, ok := toolPathsFromContext(c.Context)
if !ok {
return nil, nil, nil, errors.New("toolPaths not present in context")
}
ts, err := readToolState(tp.StatePath())
if err != nil {
return nil, nil, nil, err
}
save := func() error {
return writeToolState(ts, tp.StatePath())
}
return tp, ts, save, nil
}