Skip to content

Commit

Permalink
Added command line documentation (#6160)
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalSenn authored May 19, 2023
1 parent 1da0ee3 commit d7bb2d4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions website/src/docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,10 @@
{
"path": "batching",
"title": "Batching"
},
{
"path": "command-line",
"title": "Command Line"
}
]
},
Expand Down
38 changes: 38 additions & 0 deletions website/src/docs/hotchocolate/v13/server/command-line.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: Command Line
---

# Overview
The `HotChocolate.AspNetCore.CommandLine` package extends the `IHostBuilder` interface, offering a command-line interface for managing GraphQL schemas.
This extension provides a seamless experience for developers, allowing them to export their schemas directly from the command line, which can be beneficial for CI/CD.

# Setup the Command Line Interface

Here's an example of using the `HotChocolate.AspNetCore.CommandLine` package with a minimal API and a simple setup:

```csharp
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddGraphQLServer().AddQueryType<Query>();

var app = builder.Build();

app.MapGraphQL();

app.RunWithGraphQLCommandsAsync(args);
```

# Commands

## Schema Export Command

The `schema export` command exports the GraphQL schema. By default, the schema is printed to the console. However, you can specify an output file using the `--output` option.

```shell
dotnet run -- schema export --output schema.graphql
```

**Options**

- `--output`: The path to the file where the schema should be exported. If no output path is specified, the schema will be printed to the console.
- `--schema-name`: The name of the schema to be exported. If no schema name is specified, the default schema will be exported.

0 comments on commit d7bb2d4

Please sign in to comment.