Skip to content

Commit

Permalink
feat(backend): Added the dry-run flag for the LaTeX generation (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhbert authored Nov 21, 2024
1 parent 62ed3d8 commit bb9d459
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmd/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ type ColligendisFlags struct {
SortType string
ViewMode bool
Limit int
DryRun bool
}
1 change: 1 addition & 0 deletions cmd/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func createRootCommand(flags *common.ColligendisFlags, tmpls []structs.TemplateS
cmd.AddCommand(convert.GetConvertCommand(flags, tmpls))

cmd.PersistentFlags().BoolVarP(&flags.ViewMode, "verbose", "v", false, "Show the full report of the commands")
cmd.PersistentFlags().BoolVarP(&flags.DryRun, "dry-run", "", false, "Start command without real generation")

return cmd
}
9 changes: 5 additions & 4 deletions internal/latex_service/latex.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ func GenerateLaTeXFiles(tmpls []structs.TemplateStruct, flags *common.Colligendi
log.Printf("Unable to create file: %w", err)
}

generatePDF(flags)
generatePDF(flags)

copyFile(templateData.LatestDate)
if !flags.DryRun {
generatePDF(flags)
generatePDF(flags)
copyFile(templateData.LatestDate)
}
}

func getHabrData() structs.TemplateData {
Expand Down

0 comments on commit bb9d459

Please sign in to comment.