MCPcopy Create free account
hub / github.com/dotzero/git-profile / profileResolve

Function profileResolve

cmd/use.go:47–64  ·  view source on GitHub ↗
(
	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
47func 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
66func profileApply(cmd *cobra.Command, cfg storage, v vcs, profile string) {
67 entries, ok := cfg.Lookup(profile)

Callers 3

useCommandFunction · 0.85

Calls 1

NamesMethod · 0.65

Tested by 2