Skip to content

Commit be52f32

Browse files
committed
update README
1 parent c3c641c commit be52f32

3 files changed

Lines changed: 42 additions & 0 deletions

File tree

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,48 @@ Or via Go (requires Go 1.24.5 or later):
2828
go install github.com/andrearcaina/pathfinder@latest
2929
```
3030

31+
### CLI Usage
32+
33+
To generate a Go REST server, run:
34+
```
35+
> goforge generate -p rest-server -n my-server -s REST -m
36+
```
37+
This command does the following:
38+
- Creates a directory named `rest-server`
39+
- Initializes a `go.mod` file with the module name `my-server`
40+
- Configures the server type as `REST`
41+
- Generates a `Makefile`
42+
43+
### Interactive Mode (TUI)
44+
45+
If any required flags are missing, an interactive TUI will appear:
46+
![goforge-no-db-flag](images/goforge-no-db-flag.png)
47+
48+
You can see that the TUI appears, asking if you should generate the database files.
49+
50+
The following fields must be provided either via CLI flags or through the TUI:
51+
52+
```go
53+
type ServerTypeFlag string
54+
55+
const (
56+
REST ServerTypeFlag = "rest"
57+
GRPC ServerTypeFlag = "grpc"
58+
GraphQL ServerTypeFlag = "graphql"
59+
)
60+
61+
type Form struct {
62+
Name string
63+
ServerTypeFlag ServerTypeFlag
64+
DatabaseFlag bool
65+
MakefileFlag bool
66+
}
67+
```
68+
If you run with the database flag enabled (including `--database`), the TUI is skipped and will generate your server (since the form is technically filled out).
69+
70+
For example, the following command will trigger the TUI:
71+
![goforge TUI](images/goforge-tui.png)
72+
3173
### TODO
3274

3375
In no particular order:

images/goforge-no-db-flag.png

10.5 KB
Loading

images/goforge-tui.png

7.68 KB
Loading

0 commit comments

Comments
 (0)