core/commands: Enabled stdin for various command arguments
Matt Bell committed
Jan 12, 2015 at 20:15 UTC
86bb8ca7a710c2b1196480f385d63ab362411731
10 files changed
+15
-15
core/commands/block.go
+2
-2
@@ -55,7 +55,7 @@ on raw ipfs blocks. It outputs the following to stdout:
55
},
56
57
Arguments: []cmds.Argument{
58
- cmds.StringArg("key", true, false, "The base58 multihash of an existing block to get"),
58
+ cmds.StringArg("key", true, false, "The base58 multihash of an existing block to get").EnableStdin(),
59
},
60
Run: func(req cmds.Request) (interface{}, error) {
61
b, err := getBlockForKey(req, req.Arguments()[0])
@@ -87,7 +87,7 @@ It outputs to stdout, and <key> is a base58 encoded multihash.
87
},
88
89
Arguments: []cmds.Argument{
90
- cmds.StringArg("key", true, false, "The base58 multihash of an existing block to get"),
90
+ cmds.StringArg("key", true, false, "The base58 multihash of an existing block to get").EnableStdin(),
91
},
92
Run: func(req cmds.Request) (interface{}, error) {
93
b, err := getBlockForKey(req, req.Arguments()[0])
core/commands/id.go
+1
-1
@@ -43,7 +43,7 @@ if no peer is specified, prints out local peers info.
43
`,
44
},
45
Arguments: []cmds.Argument{
46
- cmds.StringArg("peerid", false, false, "peer.ID of node to look up"),
46
+ cmds.StringArg("peerid", false, false, "peer.ID of node to look up").EnableStdin(),
47
},
48
Run: func(req cmds.Request) (interface{}, error) {
49
node, err := req.Context().GetNode()
core/commands/ls.go
+1
-1
@@ -35,7 +35,7 @@ it contains, with the following format:
35
},
36
37
Arguments: []cmds.Argument{
38
- cmds.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to list links from"),
38
+ cmds.StringArg("ipfs-path", true, true, "The path to the IPFS object(s) to list links from").EnableStdin(),
39
},
40
Run: func(req cmds.Request) (interface{}, error) {
41
node, err := req.Context().GetNode()
core/commands/object.go
+4
-4
@@ -69,7 +69,7 @@ output is the raw data of the object.
69
},
70
71
Arguments: []cmds.Argument{
72
- cmds.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format"),
72
+ cmds.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format").EnableStdin(),
73
},
74
Run: func(req cmds.Request) (interface{}, error) {
75
n, err := req.Context().GetNode()
@@ -93,7 +93,7 @@ multihash.
93
},
94
95
Arguments: []cmds.Argument{
96
- cmds.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format"),
96
+ cmds.StringArg("key", true, false, "Key of the object to retrieve, in base58-encoded multihash format").EnableStdin(),
97
},
98
Run: func(req cmds.Request) (interface{}, error) {
99
n, err := req.Context().GetNode()
@@ -135,7 +135,7 @@ This command outputs data in the following encodings:
135
},
136
137
Arguments: []cmds.Argument{
138
- cmds.StringArg("key", true, false, "Key of the object to retrieve (in base58-encoded multihash format)"),
138
+ cmds.StringArg("key", true, false, "Key of the object to retrieve (in base58-encoded multihash format)").EnableStdin(),
139
},
140
Run: func(req cmds.Request) (interface{}, error) {
141
n, err := req.Context().GetNode()
@@ -199,7 +199,7 @@ var objectStatCmd = &cmds.Command{
199
},
200
201
Arguments: []cmds.Argument{
202
- cmds.StringArg("key", true, false, "Key of the object to retrieve (in base58-encoded multihash format)"),
202
+ cmds.StringArg("key", true, false, "Key of the object to retrieve (in base58-encoded multihash format)").EnableStdin(),
203
},
204
Run: func(req cmds.Request) (interface{}, error) {
205
n, err := req.Context().GetNode()
core/commands/pin.go
+2
-2
@@ -31,7 +31,7 @@ on disk.
31
},
32
33
Arguments: []cmds.Argument{
34
- cmds.StringArg("ipfs-path", true, true, "Path to object(s) to be pinned"),
34
+ cmds.StringArg("ipfs-path", true, true, "Path to object(s) to be pinned").EnableStdin(),
35
},
36
Options: []cmds.Option{
37
cmds.BoolOption("recursive", "r", "Recursively pin the object linked to by the specified object(s)"),
@@ -71,7 +71,7 @@ collected if needed.
71
},
72
73
Arguments: []cmds.Argument{
74
- cmds.StringArg("ipfs-path", true, true, "Path to object(s) to be unpinned"),
74
+ cmds.StringArg("ipfs-path", true, true, "Path to object(s) to be unpinned").EnableStdin(),
75
},
76
Options: []cmds.Option{
77
cmds.BoolOption("recursive", "r", "Recursively unpin the object linked to by the specified object(s)"),
core/commands/ping.go
+1
-1
@@ -37,7 +37,7 @@ trip latency information.
37
`,
38
},
39
Arguments: []cmds.Argument{
40
- cmds.StringArg("peer ID", true, true, "ID of peer to be pinged"),
40
+ cmds.StringArg("peer ID", true, true, "ID of peer to be pinged").EnableStdin(),
41
},
42
Options: []cmds.Option{
43
cmds.IntOption("count", "n", "number of ping messages to send"),
core/commands/publish.go
+1
-1
@@ -44,7 +44,7 @@ Publish a <ref> to another public key:
44
45
Arguments: []cmds.Argument{
46
cmds.StringArg("name", false, false, "The IPNS name to publish to. Defaults to your node's peerID"),
47
- cmds.StringArg("ipfs-path", true, false, "IPFS path of the obejct to be published at <name>"),
47
+ cmds.StringArg("ipfs-path", true, false, "IPFS path of the obejct to be published at <name>").EnableStdin(),
48
},
49
Run: func(req cmds.Request) (interface{}, error) {
50
log.Debug("Begin Publish")
core/commands/refs.go
+1
-1
@@ -45,7 +45,7 @@ Note: list all refs recursively with -r.
45
"local": RefsLocalCmd,
46
},
47
Arguments: []cmds.Argument{
48
- cmds.StringArg("ipfs-path", true, true, "Path to the object(s) to list refs from"),
48
+ cmds.StringArg("ipfs-path", true, true, "Path to the object(s) to list refs from").EnableStdin(),
49
},
50
Options: []cmds.Option{
51
cmds.StringOption("format", "Emit edges with given format. tokens: <src> <dst> <linkname>"),
core/commands/resolve.go
+1
-1
@@ -38,7 +38,7 @@ Resolve te value of another name:
38
},
39
40
Arguments: []cmds.Argument{
41
- cmds.StringArg("name", false, false, "The IPNS name to resolve. Defaults to your node's peerID."),
41
+ cmds.StringArg("name", false, false, "The IPNS name to resolve. Defaults to your node's peerID.").EnableStdin(),
42
},
43
Run: func(req cmds.Request) (interface{}, error) {
44
core/commands/swarm.go
+1
-1
@@ -83,7 +83,7 @@ ipfs swarm connect /ip4/104.131.131.82/tcp/4001/QmaCpDMGvV2BGHeYERUEnRQAwe3N8Szb
83
`,
84
},
85
Arguments: []cmds.Argument{
86
- cmds.StringArg("address", true, true, "address of peer to connect to"),
86
+ cmds.StringArg("address", true, true, "address of peer to connect to").EnableStdin(),
87
},
88
Run: func(req cmds.Request) (interface{}, error) {
89
ctx := context.TODO()