Function
profileResolve
(
args []string,
in io.Reader,
out io.Writer,
cfg storage,
selectProfile func([]string, io.Reader, io.Writer) (string, error),
)
Source from the content-addressed store, hash-verified
| 45 | } |
| 46 | |
| 47 | func profileResolve( |
| 48 | args []string, |
| 49 | in io.Reader, |
| 50 | out io.Writer, |
| 51 | cfg storage, |
| 52 | selectProfile func([]string, io.Reader, io.Writer) (string, error), |
| 53 | ) (string, error) { |
| 54 | if len(args) > 0 { |
| 55 | return args[0], nil |
| 56 | } |
| 57 | |
| 58 | profile, err := selectProfile(cfg.Names(), in, out) |
| 59 | if err != nil { |
| 60 | return "", fmt.Errorf("Unable to select a profile: %w", err) |
| 61 | } |
| 62 | |
| 63 | return profile, nil |
| 64 | } |
| 65 | |
| 66 | func profileApply(cmd *cobra.Command, cfg storage, v vcs, profile string) { |
| 67 | entries, ok := cfg.Lookup(profile) |