MCPcopy Index your code
hub / github.com/256dpi/gcode / parseCommand

Function parseCommand

cmd/gcode/command.go:24–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22}
23
24func parseCommand() *command {
25 usage := `gcode.
26
27Usage:
28 gcode info <input>
29 gcode strip <input> <output>
30 gcode offset <input> <output> <x> <y> <z>
31 gcode svg <input> <output>
32
33Options:
34 -h --help Show this screen.
35`
36
37 a, _ := docopt.Parse(usage, nil, true, "", false)
38
39 return &command{
40 // commands
41 cInfo: getBool(a["info"]),
42 cStrip: getBool(a["strip"]),
43 cOffset: getBool(a["offset"]),
44 cSVG: getBool(a["svg"]),
45
46 // arguments
47 aInput: getString(a["<input>"]),
48 aOutput: getString(a["<output>"]),
49 aX: getFloat(a["<x>"]),
50 aY: getFloat(a["<y>"]),
51 aZ: getFloat(a["<z>"]),
52 }
53}
54
55func getBool(field interface{}) bool {
56 if val, ok := field.(bool); ok {

Callers 1

mainFunction · 0.85

Calls 3

getBoolFunction · 0.85
getStringFunction · 0.85
getFloatFunction · 0.85

Tested by

no test coverage detected