func logResult(ctx *tool.Context, action string, mgr profiles.Manager, target profiles.Target, err error) { fmt.Fprintf(ctx.Stdout(), "%s: %s %s: ", action, mgr.Name(), target) if err == nil { fmt.Fprintf(ctx.Stdout(), "success\n") } else { fmt.Fprintf(ctx.Stdout(), "%v\n", err) } }
func logResult(jirix *jiri.X, action string, mgr profiles.Manager, target profiles.Target, err error) { fmt.Fprintf(jirix.Stdout(), "%s: %s %s: ", action, profiles.QualifiedProfileName(mgr.Installer(), mgr.Name()), target) if err == nil { fmt.Fprintf(jirix.Stdout(), "success\n") } else { fmt.Fprintf(jirix.Stdout(), "%v\n", err) } }
func targetAtDefaultVersion(mgr profiles.Manager, target profiles.Target) (profiles.Target, error) { def := target version, err := mgr.VersionInfo().Select(target.Version()) if err != nil { return profiles.Target{}, err } def.SetVersion(version) return def, nil }
// Register is used to register a profile manager. It is an error // to call Registerr more than once with the same name, though it // is possible to register the same Manager using different names. func Register(mgr profiles.Manager) { registry.Lock() defer registry.Unlock() qualifiedName := profiles.QualifiedProfileName(mgr.Installer(), mgr.Name()) if _, present := registry.managers[qualifiedName]; present { panic("a profile manager is already registered for: " + qualifiedName) } registry.managers[qualifiedName] = mgr }