-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
67 lines (64 loc) · 1.46 KB
/
main.go
File metadata and controls
67 lines (64 loc) · 1.46 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package main
import (
"context"
"github.com/urfave/cli/v3"
"log"
"os"
)
func main() {
cmd := &cli.Command{
Name: "crlancli",
Description: "a cli utility to interact with networked creality printers",
Usage: "interact with networked creality printers",
Commands: []*cli.Command{
{
Name: "scan",
Usage: "scans the network for any printers",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "long",
Aliases: []string{"l"},
Usage: "scans for 15 seconds instead of just 3",
},
},
Action: ScanForPrinters,
},
{
Name: "temp",
Usage: "temprature readings for a printer",
Arguments: []cli.Argument{
&cli.StringArg{
Name: "printer",
UsageText: "[printer ip address/hostname, eg. 192.168.1.218] ",
},
},
Action: TempAction,
},
{
Name: "send",
Usage: "transfer a gcode file to a printer",
Arguments: []cli.Argument{
&cli.StringArg{
Name: "file",
UsageText: "[gcode file] ",
},
&cli.StringArg{
Name: "printer",
UsageText: "[printer ip address/hostname, eg. 192.168.1.218] ",
},
},
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "print",
Aliases: []string{"p"},
Usage: "whether or not to start printing the file after transferring",
},
},
Action: SendAction,
},
},
}
if err := cmd.Run(context.Background(), os.Args); err != nil {
log.Fatal(err)
}
}