Merge pull request #614 from jbenet/misc-1-16

Miscellaneous Changes
This commit is contained in:
Juan Batiz-Benet 2015-01-23 19:42:56 -08:00
commit 9a05522966
5 changed files with 33 additions and 11 deletions

View File

@ -238,7 +238,7 @@ func identityConfig(nbits int) (config.Identity, error) {
return ident, debugerror.New("Bitsize less than 1024 is considered unsafe.")
}
fmt.Printf("generating key pair...")
fmt.Printf("generating %v-bit RSA keypair...", nbits)
sk, pk, err := ci.GenerateKeyPair(ci.RSA, nbits)
if err != nil {
return ident, err

View File

@ -153,8 +153,14 @@ func getResponse(httpRes *http.Response, req cmds.Request) (cmds.Response, error
outputType := reflect.TypeOf(req.Command().Type)
for {
v := reflect.New(outputType).Interface()
err := dec.Decode(v)
var v interface{}
var err error
if outputType != nil {
v = reflect.New(outputType).Interface()
err = dec.Decode(v)
} else {
err = dec.Decode(&v)
}
if err != nil && err != io.EOF {
fmt.Println(err.Error())
return
@ -200,13 +206,20 @@ func getResponse(httpRes *http.Response, req cmds.Request) (cmds.Response, error
} else {
outputType := reflect.TypeOf(req.Command().Type)
v := reflect.New(outputType).Interface()
err = dec.Decode(v)
var v interface{}
if outputType != nil {
v = reflect.New(outputType).Interface()
err = dec.Decode(v)
} else {
err = dec.Decode(&v)
}
if err != nil && err != io.EOF {
return nil, err
}
res.SetOutput(v)
if v != nil {
res.SetOutput(v)
}
}
return res, nil

View File

@ -69,7 +69,7 @@ in the bootstrap list).
},
Arguments: []cmds.Argument{
cmds.StringArg("peer", false, true, peerOptionDesc),
cmds.StringArg("peer", false, true, peerOptionDesc).EnableStdin(),
},
Options: []cmds.Option{
@ -138,7 +138,7 @@ var bootstrapRemoveCmd = &cmds.Command{
},
Arguments: []cmds.Argument{
cmds.StringArg("peer", false, true, peerOptionDesc),
cmds.StringArg("peer", false, true, peerOptionDesc).EnableStdin(),
},
Options: []cmds.Option{
cmds.BoolOption("all", "Remove all bootstrap peers."),

View File

@ -28,6 +28,7 @@ Basic commands:
add <path> Add an object to ipfs
cat <ref> Show ipfs object data
ls <ref> List links from an object
refs <ref> List hashes of links from an object
Tool commands:
@ -36,14 +37,22 @@ Tool commands:
version Show ipfs version information
commands List all available commands
id Show info about ipfs peers
pin Pin objects to local storage
name Publish or resolve IPNS names
log Change the logging level
Advanced Commands:
daemon Start a long-running daemon process
mount Mount an ipfs read-only mountpoint
serve Serve an interface to ipfs
diag Print diagnostics
Network commands:
swarm Manage connections to the p2p network
bootstrap Add or remove bootstrap peers
ping Measure the latency of a connection
Plumbing commands:
block Interact with raw blocks in the datastore

View File

@ -36,7 +36,7 @@ test_expect_success "ipfs peer id looks good" '
test_expect_success "ipfs init output looks good" '
STARTHASH="QmYpv2VEsxzTTXRYX3PjDg961cnJE3kY1YDXLycHGQ3zZB" &&
echo "initializing ipfs node at $IPFS_PATH" >expected &&
echo "generating key pair...done" >>expected &&
echo "generating 4096-bit RSA keypair...done" >>expected &&
echo "peer identity: $PEERID" >>expected &&
printf "\\n%s\\n" "to get started, enter: ipfs cat $STARTHASH" >>expected &&
test_cmp expected actual_init