Skip to content

[13.3] Document command return values #682

@JamesNK

Description

@JamesNK

Commands can now return a value. e.g.

       .WithCommand(
           name: "migrate-database",
           displayName: "Migrate Database",
           executeCommand: (c) =>
           {
               var markdown = """
                   # ⚙️ Database Migration Summary

                   | Table      | Result                     |
                   |------------|----------------------------|
                   | Customers  | ✅ 1,200 rows              |
                   | Products   | ✅ 850 rows                |
                   | Orders     | ✅ 3,400 rows              |
                   | OrderItems | ✅ 8,750 rows              |
                   | Categories | ✅ 45 rows                 |
                   | Reviews    | ❌ FK constraint violation |
                   | Inventory  | ✅ 850 rows                |
                   | Shipping   | ✅ 3,400 rows              |
                   | Payments   | ❌ Timeout after 30s       |
                   | Coupons    | ✅ 120 rows                |

                   **Summary:** 8 of 10 tables migrated successfully. 2 tables failed.
                   """;
               return Task.FromResult(CommandResults.Success("Database migrated.", new CommandResultData { Value = markdown, Format = CommandResultFormat.Markdown }));
           },
           commandOptions: new() { IconName = "CloudDatabase", Description = "Migrate the database with sample store data" });

Needs to be documented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions