Skip to content

Commit

Permalink
Rename --config to --repo
Browse files Browse the repository at this point in the history
Closes #1296

License: MIT
Signed-off-by: dignifiedquire <dignifiedquire@gmail.com>
  • Loading branch information
dignifiedquire committed Apr 4, 2016
1 parent 8acd87d commit e2bc6da
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cmd/ipfs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,11 @@ func isClientError(err error) bool {
}

func getRepoPath(req cmds.Request) (string, error) {
repoOpt, found, err := req.Option("config").String()
repoOpt, found, err := req.Option("repo").String()
if err != nil {
return "", err
}

if found && repoOpt != "" {
return repoOpt, nil
}
Expand All @@ -464,6 +465,7 @@ func getRepoPath(req cmds.Request) (string, error) {
if err != nil {
return "", err
}

return repoPath, nil
}

Expand Down
6 changes: 4 additions & 2 deletions core/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ TOOL COMMANDS
Use 'ipfs <command> --help' to learn more about each command.
ipfs uses a repository in the local file system. By default, the repo is located
at ~/.ipfs. To change the repo location, set the $IPFS_PATH environment variable:
at ~/.ipfs. To change the repo location, you can either use --repo or set the $IPFS_PATH environment variable:
ipfs <cmd> --repo=/path/to/ipfsrepo
export IPFS_PATH=/path/to/ipfsrepo
`,
},
Options: []cmds.Option{
cmds.StringOption("config", "c", "Path to the configuration file to use."),
cmds.StringOption("repo", "R", "Path to the configuration file to use."),
cmds.BoolOption("debug", "D", "Operate in debug mode."),
cmds.BoolOption("help", "Show the full command help text."),
cmds.BoolOption("h", "Show a short version of the command help text."),
Expand Down
20 changes: 20 additions & 0 deletions test/sharness/t0020-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,26 @@ test_expect_success "clean up ipfs dir" '
rm -rf "$IPFS_PATH"
'

test_expect_success "'ipfs init --repo' succeeds" '
BITS="1024" &&
ipfs init --bits="$BITS" --repo="$(pwd)/.ipfs2" >actual_init
'

test_expect_success "'ipfs init --repo' output looks good" '
export IPFS_PATH=$(pwd)/.ipfs2 &&
PEERID=$(ipfs config Identity.PeerID) &&
echo "initializing ipfs node at $(pwd)/.ipfs2" >expected &&
echo "generating $BITS-bit RSA keypair...done" >>expected &&
echo "peer identity: $PEERID" >>expected &&
echo "to get started, enter:" >>expected &&
printf "\\n\\t$STARTFILE\\n\\n" >>expected &&
test_cmp expected actual_init
'

test_expect_success "clean up ipfs dir" '
rm -rf "$IPFS_PATH"
'

test_init_ipfs

test_launch_ipfs_daemon
Expand Down

0 comments on commit e2bc6da

Please sign in to comment.