-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd.go
66 lines (59 loc) 路 1.51 KB
/
cmd.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package ix
import (
_ "embed"
"fmt"
Z "github.com/rwxrob/bonzai/z"
"github.com/rwxrob/help"
)
//go:embed post.md
var postDesc string
//go:embed get.md
var getDesc string
var Cmd = &Z.Cmd{
Name: `ix`,
Aliases: []string{`ix`},
Usage: `[help|PATH]`,
Summary: `ix requests`,
Copyright: `Copyright 2023 Christian Hageloch`,
Version: `v0.1.1`,
License: `MIT`,
Source: `git@github.com:chriswifn/give.git`,
Issues: `github.com/chriswifn/give/issues`,
Commands: []*Z.Cmd{help.Cmd, postCmd, getCmd},
}
var postCmd = &Z.Cmd{
Name: `post`,
Aliases: []string{`up`},
Usage: `[help|PATH]`,
Summary: `ix post request`,
Copyright: `Copyright 2023 Christian Hageloch`,
Version: `v0.1.1`,
License: `MIT`,
Source: `git@github.com:chriswifn/give.git`,
Issues: `github.com/chriswifn/give/issues`,
Commands: []*Z.Cmd{help.Cmd},
Description: postDesc,
Call: func(x *Z.Cmd, args ...string) error {
buf := Z.ArgsOrIn(args)
fmt.Print(post(buf))
return nil
},
}
var getCmd = &Z.Cmd{
Name: `get`,
Aliases: []string{`down`},
Usage: `[help|PATH]`,
Summary: `ix get request`,
Copyright: `Copyright 2023 Christian Hageloch`,
Version: `v0.1.1`,
License: `MIT`,
Source: `git@github.com:chriswifn/give.git`,
Issues: `github.com/chriswifn/give/issues`,
Commands: []*Z.Cmd{help.Cmd},
Description: getDesc,
Call: func(x *Z.Cmd, args ...string) error {
in := Z.ArgsOrIn(args)
fmt.Print(get(in))
return nil
},
}