(conf *viper.Viper)
| 628 | } |
| 629 | |
| 630 | func info(conf *viper.Viper) error { |
| 631 | userId, groupId, err := getUserAndGroup(conf) |
| 632 | if err != nil { |
| 633 | return err |
| 634 | } |
| 635 | |
| 636 | dc, cancel, err := getClientWithAdminCtx(conf) |
| 637 | if err != nil { |
| 638 | return fmt.Errorf("unable to get admin context: %w", err) |
| 639 | } |
| 640 | defer cancel() |
| 641 | |
| 642 | ctx, ctxCancel := context.WithTimeout(context.Background(), 10*time.Second) |
| 643 | defer ctxCancel() |
| 644 | txn := dc.NewTxn() |
| 645 | defer func() { |
| 646 | if err := txn.Discard(ctx); err != nil { |
| 647 | fmt.Printf("Unable to discard transaction: %v\n", err) |
| 648 | } |
| 649 | }() |
| 650 | |
| 651 | if len(userId) != 0 { |
| 652 | return queryAndPrintUser(ctx, txn, userId) |
| 653 | } |
| 654 | |
| 655 | return queryAndPrintGroup(ctx, txn, groupId) |
| 656 | } |
no test coverage detected