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

Hook mongosh conversion code into CLI #16

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

noisersup
Copy link
Collaborator

Closes #10.


b, err := mongosh.ConvertFixtures(fxs)

f, err := os.OpenFile(filepath.Join(cli.Convert.OutDir, "convert.js"), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like os.Create?

@@ -10,6 +10,7 @@ require (
github.com/neilotoole/slogt v1.1.0
github.com/pmezard/go-difflib v1.0.0
github.com/stretchr/testify v1.10.0
go.mongodb.org/mongo-driver v1.17.3
Copy link
Contributor

Choose a reason for hiding this comment

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

We should not import it

We might want to introduce some convertion function on wirebson, if we
don't want to use the driver.
@noisersup noisersup self-assigned this Mar 20, 2025
@noisersup noisersup marked this pull request as ready for review March 20, 2025 14:58
@noisersup noisersup enabled auto-merge (squash) March 20, 2025 14:58
@noisersup noisersup requested review from chilagrow and AlekSi March 20, 2025 15:10
Copy link
Contributor

@AlekSi AlekSi left a comment

Choose a reason for hiding this comment

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

What about requests and responses?

return err
}

f, err := os.Create(filepath.Join(cli.Convert.OutDir, "convert.js"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why filename is fixed? Why it is a single file?

@@ -38,6 +40,10 @@ var cli struct {

Fmt struct{} `cmd:"" help:"Reformat CTS files."`

Convert struct {
OutDir string `type:"path" arg:"" help:"Output directory."`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should it create a directory if it doesn't exist?

@@ -58,6 +64,29 @@ func fmtCommand() error {
return data.SaveTestSuites(tss, cli.Dir, nil)
}

// runCommand implements the "convert" command.
func convertCommand() error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you write a test?

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.

Hook mongosh conversion code into CLI
3 participants