mdeuser commented on a change in pull request #2520: Prints bashauto-completion 
install script to STDOUT
URL: 
https://github.com/apache/incubator-openwhisk/pull/2520#discussion_r130676229
 
 

 ##########
 File path: tools/cli/go-whisk-cli/commands/sdk.go
 ##########
 @@ -99,6 +106,58 @@ var sdkInstallCmd = &cobra.Command{
     },
 }
 
+// addToBash() attempts to find user's .bashrc and append the line
+// "eval \"`wsk sdk install bashauto`\"" to it unless the line already exists
+func addToBash() error {
+    var usr *user.User
+    var bash *os.File
+    var exists bool
+    var err error
+
+    bashCheck := "wsk sdk install bashauto"
+    bashCmd := "eval \"`wsk sdk install bashauto`\""
+
+    if usr, err = user.Current(); err != nil {
+        whisk.Debug(whisk.DbgError, "Couldn't find User Directory: %s\n", err)
+        return err
+    }
+    whisk.Debug(whisk.DbgInfo, "Found current user %s\n", usr.HomeDir)
+    bashLoc := fmt.Sprintf("%s/%s", usr.HomeDir, ".bashrc")
 
 Review comment:
   cli is already using homedir, which is a good fit here
   ```
   import "github.com/mitchellh/go-homedir"
   ...
   bashLoc, err := homedir.Expand(".bashrc")
   ```
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to