diff --git a/PENDING.md b/PENDING.md index 8e7f45d86..7bc7cc683 100644 --- a/PENDING.md +++ b/PENDING.md @@ -27,8 +27,8 @@ FEATURES * Modules can test random combinations of their own operations * Applications can integrate operations and invariants from modules together for an integrated simulation * [baseapp] Initialize validator set on ResponseInitChain -* Added support for cosmos-sdk-cli tool under cosmos-sdk/cmd - * This allows SDK users to init a new project repository with a single command. +* [cosmos-sdk-cli] Added support for cosmos-sdk-cli tool under cosmos-sdk/cmd + * This allows SDK users to initialize a new project repository. IMPROVEMENTS * [baseapp] Allow any alphanumeric character in route diff --git a/cmd/cosmos-sdk-cli/cmd/init.go b/cmd/cosmos-sdk-cli/cmd/init.go index 5a0f3ddb3..d5d6422ad 100644 --- a/cmd/cosmos-sdk-cli/cmd/init.go +++ b/cmd/cosmos-sdk-cli/cmd/init.go @@ -44,9 +44,9 @@ var initCmd = &cobra.Command{ "basecoind", shortProjectName+"d", "BasecoinApp", capitalizedProjectName+"App", remoteBasecoinPath, remoteProjectPath, - "basecoin", shortProjectName) - setupBasecoinWorkspace(shortProjectName, remoteProjectPath) - return nil + "basecoin", shortProjectName, + "Basecoin", capitalizedProjectName) + return setupBasecoinWorkspace(shortProjectName, remoteProjectPath) }, } @@ -142,11 +142,16 @@ benchmark: } -func setupBasecoinWorkspace(projectName string, remoteProjectPath string) { +func setupBasecoinWorkspace(projectName string, remoteProjectPath string) error { projectPath := resolveProjectPath(remoteProjectPath) fmt.Println("Configuring your project in " + projectPath) + // Check if the projectPath already exists or not + if _, err := os.Stat(projectPath); !os.IsNotExist(err) { + return fmt.Errorf("Unable to initialize the project. %s already exists", projectPath) + } copyBasecoinTemplate(projectName, projectPath, remoteProjectPath) createGopkg(projectPath) createMakefile(projectPath) - fmt.Printf("\nInitialized a new project at %s.\nHappy hacking!\n", projectPath) + fmt.Printf("Initialized a new project at %s.\nHappy hacking!\n", projectPath) + return nil }