List "Installing" sdks by default.
[src/xds/xds-cli.git] / utils.go
index 65b67d3..b47cd04 100644 (file)
--- a/utils.go
+++ b/utils.go
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 "IoT.bzh"
+ * Copyright (C) 2017-2018 "IoT.bzh"
  * Author Sebastien Douheret <sebastien@iot.bzh>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,9 +22,10 @@ import (
        "encoding/json"
        "fmt"
        "strconv"
+       "strings"
 
+       "gerrit.automotivelinux.org/gerrit/src/xds/xds-agent.git/lib/xaapiv1"
        "github.com/franciscocpg/reflectme"
-       "github.com/iotbzh/xds-agent/lib/xaapiv1"
        "github.com/urfave/cli"
 )
 
@@ -115,3 +116,12 @@ func GetID(ctx *cli.Context) string {
        }
        return id
 }
+
+// Confirm Return true when user answer 'y' or 'yes' to a question
+func Confirm(question string) bool {
+       var answer string
+       fmt.Print(question)
+       fmt.Scanln(&answer)
+       ans := strings.ToLower(strings.TrimSpace(answer))
+       return (ans == "y" || ans == "yes")
+}