MCPcopy Create free account
hub / github.com/openclaw/gogcli / Run

Method Run

internal/cmd/admin_users.go:321–357  ·  view source on GitHub ↗
(ctx context.Context, flags *RootFlags)

Source from the content-addressed store, hash-verified

319}
320
321func (c *AdminUsersDeleteCmd) Run(ctx context.Context, flags *RootFlags) error {
322 userEmail := strings.TrimSpace(c.UserEmail)
323 if userEmail == "" {
324 return usage("user email required")
325 }
326
327 if confirmErr := dryRunAndConfirmDestructive(ctx, flags, "admin.users.delete", map[string]any{
328 "email": userEmail,
329 }, fmt.Sprintf("delete user %s", userEmail)); confirmErr != nil {
330 return confirmErr
331 }
332
333 account, err := requireAdminAccount(flags)
334 if err != nil {
335 return err
336 }
337
338 svc, err := adminDirectoryService(ctx, account)
339 if err != nil {
340 return wrapAdminDirectoryError(err, account)
341 }
342
343 if err := svc.Users.Delete(userEmail).Context(ctx).Do(); err != nil {
344 return wrapAdminDirectoryError(err, account)
345 }
346
347 if outfmt.IsJSON(ctx) {
348 return outfmt.WriteJSON(ctx, stdoutWriter(ctx), map[string]any{
349 "email": userEmail,
350 "deleted": true,
351 })
352 }
353
354 u := ui.FromContext(ctx)
355 u.Out().Linef("Deleted user: %s", userEmail)
356 return nil
357}
358
359type AdminUsersSuspendCmd struct {
360 UserEmail string `arg:"" name:"userEmail" help:"User email to suspend"`

Callers

nothing calls this directly

Calls 13

IsJSONFunction · 0.92
WriteJSONFunction · 0.92
FromContextFunction · 0.92
usageFunction · 0.85
requireAdminAccountFunction · 0.85
adminDirectoryServiceFunction · 0.85
wrapAdminDirectoryErrorFunction · 0.85
stdoutWriterFunction · 0.85
LinefMethod · 0.80
OutMethod · 0.80
DoMethod · 0.65

Tested by

no test coverage detected