cmd/ipfs: Moved private commands to core/commands2
Matt Bell committed
Oct 30, 2014 at 20:42 UTC
9356e1a0a1c8e8626b08e172f25e27cc1ae59787
6 files changed
+13
-21
cmd/ipfs2/ipfs.go
deleted
-15
@@ -1,15 +0,0 @@
1
-package main
2
-
3
-import (
4
- cmds "github.com/jbenet/go-ipfs/commands"
5
- commands "github.com/jbenet/go-ipfs/core/commands2"
6
-)
7
-
8
-var Root = &cmds.Command{
9
- Options: commands.Root.Options,
10
- Help: commands.Root.Help,
11
- Subcommands: map[string]*cmds.Command{
12
- "daemon": daemonCmd,
13
- "init": initCmd,
14
- },
15
-}
core/commands2/cat.go
+1
-1
@@ -7,7 +7,7 @@ import (
7
uio "github.com/jbenet/go-ipfs/unixfs/io"
8
)
9
10
-var cat = &cmds.Command{
10
+var catCmd = &cmds.Command{
11
Help: "TODO",
12
Run: func(res cmds.Response, req cmds.Request) {
13
node := req.Context().Node
core/commands2/daemon.go
renamed
+2
-1
@@ -1,4 +1,4 @@
1
-package main
1
+package commands
2
3
import (
4
"fmt"
@@ -14,6 +14,7 @@ import (
14
)
15
16
var daemonCmd = &cmds.Command{
17
+ Private: true,
18
Options: []cmds.Option{},
19
Help: "TODO",
20
Subcommands: map[string]*cmds.Command{},
core/commands2/init.go
renamed
+2
-1
@@ -1,4 +1,4 @@
1
-package main
1
+package commands
2
3
import (
4
"encoding/base64"
@@ -15,6 +15,7 @@ import (
15
)
16
17
var initCmd = &cmds.Command{
18
+ Private: true,
19
Options: []cmds.Option{
20
cmds.Option{[]string{"bits", "b"}, cmds.Int},
21
cmds.Option{[]string{"passphrase", "p"}, cmds.String},
core/commands2/ls.go
+1
-1
@@ -20,7 +20,7 @@ type LsOutput struct {
20
Objects []Object
21
}
22
23
-var ls = &cmds.Command{
23
+var lsCmd = &cmds.Command{
24
Help: "TODO",
25
Run: func(res cmds.Response, req cmds.Request) {
26
node := req.Context().Node
core/commands2/root.go
+7
-2
@@ -51,8 +51,9 @@ Plumbing commands:
51
Use "ipfs help <command>" for more information about a command.
52
`,
53
Subcommands: map[string]*cmds.Command{
54
- "cat": cat,
55
- "ls": ls,
54
+ "cat": catCmd,
55
+ "ls": lsCmd,
56
+ "init": initCmd,
57
58
// test subcommands
59
// TODO: remove these when we don't need them anymore
@@ -106,3 +107,7 @@ Use "ipfs help <command>" for more information about a command.
107
},
108
},
109
}
110
+
111
+func init() {
112
+ Root.Subcommands["daemon"] = daemonCmd
113
+}