MCPcopy Index your code
hub / github.com/cloudfoundry/cli / Usage

Method Usage

cf/commandregistry/registry.go:155–183  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

153}
154
155func (u *usagePresenter) Usage() string {
156 metadata := u.cmd.MetaData()
157
158 output := T("NAME:") + "\n"
159 output += " " + metadata.Name + " - " + metadata.Description + "\n\n"
160
161 output += T("USAGE:") + "\n"
162 output += " " + strings.Replace(strings.Join(metadata.Usage, ""), "CF_NAME", cf.Name, -1) + "\n"
163
164 if len(metadata.Examples) > 0 {
165 output += "\n"
166 output += fmt.Sprintf("%s:\n", T("EXAMPLES"))
167 for _, e := range metadata.Examples {
168 output += fmt.Sprintf(" %s\n", strings.Replace(e, "CF_NAME", cf.Name, -1))
169 }
170 }
171
172 if metadata.ShortName != "" {
173 output += "\n" + T("ALIAS:") + "\n"
174 output += " " + metadata.ShortName + "\n"
175 }
176
177 if metadata.Flags != nil {
178 output += "\n" + T("OPTIONS:") + "\n"
179 output += flags.NewFlagContext(metadata.Flags).ShowUsage(3)
180 }
181
182 return output
183}

Callers

nothing calls this directly

Calls 3

NewFlagContextFunction · 0.92
MetaDataMethod · 0.65
ShowUsageMethod · 0.65

Tested by

no test coverage detected