Skip to content

Commit cb321a8

Browse files
JeffryGonzalezjeremydmiller
authored andcommitted
updated cli commands
1 parent b752650 commit cb321a8

File tree

1 file changed

+87
-14
lines changed

1 file changed

+87
-14
lines changed

docs/configuration/cli.md

Lines changed: 87 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,97 @@ return await app.RunJasperFxCommands(args);
3636
<sup><a href='https://github.com/JasperFx/marten/blob/master/src/samples/MinimalAPI/Program.cs#L56-L62' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_using_webapplication_2' title='Start of snippet'>anchor</a></sup>
3737
<!-- endSnippet -->
3838

39-
Once the _Marten.CommandLine_ Nuget is installed and Oakton is handling your command line parsing, you should be able to see the Marten commands by typing `dotnet run -- help` in the command line terminal of your choice at the root of your project:
39+
In your command line in the project directory, you can run:
4040

4141
```bash
42-
----------------------------------------------------------------------------------------------------------
43-
Available commands:
44-
----------------------------------------------------------------------------------------------------------
45-
check-env -> Execute all environment checks against the application
46-
describe -> Writes out a description of your running application to either the console or a file
47-
help -> list all the available commands
48-
marten-apply -> Applies all outstanding changes to the database based on the current configuration
49-
marten-assert -> Assert that the existing database matches the current Marten configuration
50-
marten-dump -> Dumps the entire DDL for the configured Marten database
51-
marten-patch -> Evaluates the current configuration against the database and writes a patch and drop file if there are any differences
52-
projections -> Rebuilds all projections of specified kind
53-
run -> Start and run this .Net application
54-
----------------------------------------------------------------------------------------------------------
42+
dotnet -- help
5543
```
5644

45+
And you will be given a list of commands.
46+
47+
48+
49+
```bash
50+
The available commands are:
51+
52+
Alias Description
53+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
54+
check-env Execute all environment checks against the application
55+
codegen Utilities for working with JasperFx.CodeGeneration and JasperFx.RuntimeCompiler
56+
db-apply Applies all outstanding changes to the database(s) based on the current configuration
57+
db-assert Assert that the existing database(s) matches the current configuration
58+
db-dump Dumps the entire DDL for the configured Marten database
59+
db-list List all database(s) based on the current configuration
60+
db-patch Evaluates the current configuration against the database and writes a patch and drop file if there are any differences
61+
describe Writes out a description of your running application to either the console or a file
62+
help List all the available commands
63+
projections Asynchronous projection and projection rebuilds
64+
resources Check, setup, or teardown stateful resources of this system
65+
run Start and run this .Net application
66+
storage Administer the Wolverine message storage
67+
```
68+
69+
For any of the listed commands, you can run:
70+
71+
`dotnet -- help ` *`command`*
72+
73+
To see more information about the use of that command.
74+
75+
76+
77+
## Example Commands
78+
79+
Run these commands in your project's directory.
80+
81+
### List Your Projections
82+
```bash
83+
dotnet run -- projections list
84+
```
85+
86+
### Rebuild Your Projections
87+
88+
To rebuild *all* of your projections:
89+
90+
```bash
91+
dotnet run -- projections rebuild
92+
```
93+
To rebuild a single projection:
94+
95+
```bash
96+
dotnet run -- projections -p Course rebuild
97+
```
98+
(where `Course` is the name of the projection, from the list)
99+
100+
### Creating a SQL Script from your Marten Database
101+
102+
```sh
103+
dotnet run -- db-dump -d Marten ./marten.sql
104+
```
105+
### Codegen
106+
107+
You can use the CLI to preview, generate, write, or test the code generation:
108+
109+
To Test Codegen:
110+
111+
```bash
112+
dotnet run -- codegen test
113+
```
114+
115+
To preview codegen:
116+
117+
```bash
118+
dotnet run -- codegen preview
119+
```
120+
121+
To write the codegen to your project (in the `internal/codegen` directory):
122+
123+
```bash
124+
dotnet run -- codegen write
125+
```
126+
127+
128+
## Outside the Dotnet CLI
129+
57130
If you're not using the dotnet CLI yet, you'd just need to compile your new console application like you've always done and call the exe directly. If you're familiar with the *nix style of command-line interfaces ala Git, you should feel right at home with the command line usage in Marten.
58131
59132
For the sake of usability, let's say that you stick a file named "marten.cmd" (or the *nix shell file equivalent) at the root of your codebase like so:

0 commit comments

Comments
 (0)