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

Added transform command. #29

Merged
merged 13 commits into from
May 19, 2021
Merged

Added transform command. #29

merged 13 commits into from
May 19, 2021

Conversation

bwplotka
Copy link
Owner

Signed-off-by: Bartlomiej Plotka [email protected]

bwplotka added 2 commits May 17, 2021 01:52
Signed-off-by: Bartlomiej Plotka <[email protected]>
Signed-off-by: Bartlomiej Plotka <[email protected]>
@bwplotka bwplotka changed the title Added web command. Added fmt command. May 17, 2021
@bwplotka bwplotka changed the title Added fmt command. Added transform command. May 17, 2021
@bwplotka bwplotka force-pushed the web branch 2 times, most recently from d75d455 to f6f1466 Compare May 18, 2021 08:24
@bwplotka bwplotka marked this pull request as ready for review May 18, 2021 11:07
@saswatamcode saswatamcode self-requested a review May 18, 2021 11:43
@bwplotka bwplotka force-pushed the web branch 2 times, most recently from 4451b28 to 6660100 Compare May 18, 2021 16:50
Signed-off-by: Bartlomiej Plotka <[email protected]>
@bwplotka
Copy link
Owner Author

PTAL @saswatamcode (:

bwplotka added 4 commits May 18, 2021 19:15
Signed-off-by: Bartlomiej Plotka <[email protected]>
Signed-off-by: Bartlomiej Plotka <[email protected]>
Signed-off-by: Bartlomiej Plotka <[email protected]>
Signed-off-by: Bartlomiej Plotka <[email protected]>
bwplotka added 4 commits May 18, 2021 20:01
Signed-off-by: Bartlomiej Plotka <[email protected]>
Signed-off-by: Bartlomiej Plotka <[email protected]>
Signed-off-by: Bartlomiej Plotka <[email protected]>
Signed-off-by: Bartlomiej Plotka <[email protected]>
Copy link
Collaborator

@saswatamcode saswatamcode left a comment

Choose a reason for hiding this comment

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

This looks really amazing✨! Just some suggestions.

README.md Outdated Show resolved Hide resolved
// the same?
func registerTransform(_ context.Context, app *extkingpin.App) {
cmd := app.Command("transform", "Transform markdown files in various ways. For example pre process markdown files to allow it for use for popular static HTML websites based on markdown source code and front matter options.")
cfg := cmd.Flag("config", "Path to the YAML file with spec defined in github.com/bwplotka/mdox/pkg/transform.Config").
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe a section can be added to README about transform command, with sample config yaml, and that can be linked instead of struct? 🙂

Copy link
Owner Author

Choose a reason for hiding this comment

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

Well, we could use mdox-exec with our tool we plan to build and do this at the point? =D Great idea!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure!

pkg/transform/transform.go Outdated Show resolved Hide resolved
pkg/transform/transform.go Outdated Show resolved Hide resolved
defer errcapture.Close(&err, file, "close file")

scanner := bufio.NewScanner(file)
for scanner.Scan() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we check scanner.Err() after this loop?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Very good point, I missed this.

Where did you learn so many stuff about golang already??? ;p

Copy link
Owner Author

Choose a reason for hiding this comment

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

Done

bwplotka and others added 2 commits May 19, 2021 13:57
Signed-off-by: Bartlomiej Plotka <[email protected]>
Co-authored-by: Saswata Mukherjee <[email protected]>
@bwplotka bwplotka merged commit b9ce917 into main May 19, 2021
@bwplotka bwplotka deleted the web branch May 19, 2021 13:04
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.

2 participants