diff --git a/cmd/common/common.go b/cmd/common/common.go index 7e6a64d..af7b230 100644 --- a/cmd/common/common.go +++ b/cmd/common/common.go @@ -35,4 +35,5 @@ type ColligendisFlags struct { SortType string ViewMode bool Limit int + DryRun bool } diff --git a/cmd/root/root.go b/cmd/root/root.go index d8818db..f990d2b 100644 --- a/cmd/root/root.go +++ b/cmd/root/root.go @@ -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 } diff --git a/internal/latex_service/latex.go b/internal/latex_service/latex.go index 4707400..1089b68 100644 --- a/internal/latex_service/latex.go +++ b/internal/latex_service/latex.go @@ -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 {