Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add gofrcli docs #1409

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open

Conversation

vaidehiadhi
Copy link
Contributor

@vaidehiadhi vaidehiadhi commented Jan 20, 2025

Pull Request Template

Description:

  • Add Docs for GoFr cli

Checklist:

  • I have formatted my code using goimport and golangci-lint.
  • All new code is covered by unit tests.
  • This PR does not decrease the overall code coverage.
  • I have reviewed the code comments and documentation for clarity.

Thank you for your contribution!

docs/references/gofrcli/page.md Outdated Show resolved Hide resolved
docs/references/gofrcli/page.md Outdated Show resolved Hide resolved
docs/references/gofrcli/page.md Outdated Show resolved Hide resolved
docs/references/gofrcli/page.md Outdated Show resolved Hide resolved
docs/references/gofrcli/page.md Outdated Show resolved Hide resolved
docs/references/gofrcli/page.md Outdated Show resolved Hide resolved
@@ -165,7 +165,7 @@ export const navigation = [
{
title: 'Testing',
href: '/docs/references/testing',
desc: "GoFR provides a centralized collection of mocks to facilitate writing effective unit tests. Explore testing strategies and tools for GoFR applications, ensuring your code is robust, reliable, and maintainable."
desc: "GoFR provides a centralized collection of mocks to facilitate writing effective unit tests. Explore testing strategies and tools for GoFR applications, ensuring the code is robust, reliable, and maintainable."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GoFr .....

@@ -165,7 +165,7 @@ export const navigation = [
{
title: 'Testing',
href: '/docs/references/testing',
desc: "GoFR provides a centralized collection of mocks to facilitate writing effective unit tests. Explore testing strategies and tools for GoFR applications, ensuring your code is robust, reliable, and maintainable."
desc: "GoFR provides a centralized collection of mocks to facilitate writing effective unit tests. Explore testing strategies and tools for GoFR applications, ensuring the code is robust, reliable, and maintainable."
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the path to access the CLI documentation you have written.

Comment on lines +3 to +4
Managing repetitive tasks, ensuring consistency across projects, and maintaining efficiency in a development workflow can be challenging, especially when working on large-scale applications. Tasks like initializing projects, handling database migrations can become tedious and repetitive.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't make it verbose...This part can be removed.

Comment on lines +5 to +6
GoFr CLI addresses these challenges by providing a streamlined, all-in-one command-line tool specifically designed for GoFr applications. It simplifies tasks such as creating and managing database migrations, generating gRPC wrappers, and initializing new projects with standard GoFr conventions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the features inline bold probably.


GoFr CLI addresses these challenges by providing a streamlined, all-in-one command-line tool specifically designed for GoFr applications. It simplifies tasks such as creating and managing database migrations, generating gRPC wrappers, and initializing new projects with standard GoFr conventions.

For example, instead of manually setting up a new project structure, GoFr CLI can instantly scaffold a project with best practices in place. Similarly, managing database schema changes becomes effortless with its migration subcommands, ensuring that your database remains synchronized across environments.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it in points .....

Comment on lines +111 to +121
4. ***`version`***

The version command allows you to check the current version of the GoFr CLI tool installed on your system.
Running this command ensures that you are using the latest version of the tool, helping you stay up to date with any new features, improvements, or bug fixes.
It's a quick way to verify which version of the GoFr CLI you have.

### Command Usage

```bash
gofr version
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version should be right after, installation and not at the last.

Comment on lines +64 to +65
3. ***`wrap grpc`***

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For wrap grpc , write different section for gRPC server and different Section for gRPC Client ....

Refer the release notes of gofr-cli for the sever and client commands .... and also add the link to the examples folder for grpc-client and grpc-server.

Comment on lines +70 to +100
### Command Usage
```bash
gofr wrap grpc server --proto=<path_to_the_proto_file>
```
### Generated Files
- ```{serviceName}_gofr.go (auto-generated; do not modify)```
- ```{serviceName}_server.go (example structure below)```
- ```{serviceName}_client.go (auto-generated; do not modify)```

### Example Usage:
After generating the {serviceName}_client.go file, you can register and access the gRPC service as follows:

```go
func main() {
app := gofr.New()

// Create a gRPC client for the Hello service
helloGRPCClient, err := {clientPackage}.NewHelloGoFrClient(app.Config.Get("GRPC_SERVER_HOST"))
if err != nil {
app.Logger().Errorf("Failed to create Hello gRPC client: %v", err)
return
}

greetHandler := NewGreetHandler(helloGRPCClient)

// Register HTTP endpoint for Hello service
app.GET("/hello", greetHandler.Hello)

// Run the application
app.Run()
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have written command for server, given code for the client.... Please fix this.....

Comment on lines +106 to +109
- **Context-Aware Handling**: The generated server structure includes the necessary hooks to handle requests and responses seamlessly.
- **Minimal Configuration**: Simplifies gRPC handler setup, focusing on business logic rather than the infrastructure.

---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add context allows you to access DB and add traces or have tracing in gRPC inter-service calls as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants