+
+// GetAll returns all existing SDKs
+func (s *SDKs) GetAll() []SDK {
+ s.mutex.Lock()
+ defer s.mutex.Unlock()
+ res := s.Sdks
+ return res
+}
+
+// Get returns an SDK from id
+func (s *SDKs) Get(id int) SDK {
+ s.mutex.Lock()
+ defer s.mutex.Unlock()
+
+ if id < 0 || id > len(s.Sdks) {
+ return SDK{}
+ }
+ res := s.Sdks[id]
+ return res
+}
+
+// GetEnvCmd returns the command used to initialized the environment for an SDK
+func (s *SDKs) GetEnvCmd(id string, defaultID string) string {
+ if id == "" && defaultID == "" {
+ // no env cmd
+ return ""
+ }
+
+ s.mutex.Lock()
+ defer s.mutex.Unlock()
+ defaultEnv := ""
+ for _, sdk := range s.Sdks {
+ if sdk.ID == id {
+ return sdk.GetEnvCmd()
+ }
+ if sdk.ID == defaultID {
+ defaultEnv = sdk.GetEnvCmd()
+ }
+ }
+ // Return default env that may be empty
+ return defaultEnv
+}