diff --git a/assets/latex/template/template.tex b/assets/latex/template/template.tex index 45cff28..b078241 100644 --- a/assets/latex/template/template.tex +++ b/assets/latex/template/template.tex @@ -94,10 +94,10 @@ %VARS% \begin{center} - \textbf{\Huge \scshape \textcolor{nblue}{\Name \ \Firstname}} \\ \vspace{1pt} + \textbf{\Huge \scshape \textcolor{nblue}{\Name \ \FirstName}} \\ \vspace{1pt} \small \Number \ $|$ \href{mailto:\Mail}{\underline{\Mail}} \\ - \href{https:\Linkedin}{\underline{linkedin.com/in/\Name}} $|$ - \href{https:\Github}{\underline{github.com/\Name}} + \href{\LinkedIn}{\underline{linkedin.com/in/\Name}} $|$ + \href{\GitHub}{\underline{github.com/\Name}} \end{center} %-----------EDUCATION----------- diff --git a/cmd/root.go b/cmd/root.go index 69cb3e6..57dcf44 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -1,42 +1,50 @@ package cmd import ( - "anemon/internal/adapters/input" - "github.com/spf13/cobra" - "os" + "anemon/internal/adapters/input" + "github.com/spf13/cobra" + "os" ) var rootCmd = &cobra.Command{ - Use: "anemon", - Short: "A CV generator", - Long: `This CLI tool, automates the generation of customized CVs from Markdown files based on a specified configuration.`, - RunE: func(cmd *cobra.Command, args []string) error { - threshold, err := cmd.Flags().GetInt("threshold") - if err != nil { - return err - } - input.ChangeOverflowThreshold(threshold) - - generate, err := cmd.Flags().GetBool("generate") - if err != nil { - return err - } - if generate { - root, err := os.Getwd() - if err != nil { - return err - } - return input.GenerateCVFromMarkDownToLatex(root) - } - - return nil - }, + Use: "anemon", + Short: "A CV generator", + Long: `This CLI tool, automates the generation of customized CVs from Markdown files based on a specified configuration.`, + RunE: func(cmd *cobra.Command, args []string) error { + threshold, err := cmd.Flags().GetInt("threshold") + if err != nil { return err } + + root, err := os.Getwd() + if err != nil { return err } + + if err != nil { + return err + } + input.ChangeOverflowThreshold(threshold) + + generate, err := cmd.Flags().GetBool("generate") + if err != nil { return err } + + if generate { + return input.GenerateCVFromMarkDownToLatex(root) + } + + info, err := cmd.Flags().GetBool("cvInfo") + if err != nil { return err } + if info{ + input.PrintAllCvs(root) + return nil + } + + return nil + }, } func Execute() { - rootCmd.Flags().IntP("threshold", "t", 1, "Set the page overflow threshold (default 1)") - rootCmd.Flags().BoolP("generate", "g", false, "Generate a CV") - if err := rootCmd.Execute(); err != nil { - os.Exit(1) - } + rootCmd.Flags().IntP("threshold", "t", 1, "Set the page overflow threshold (default 1)") + rootCmd.Flags().BoolP("generate", "g", false, "Generate a CV") + rootCmd.Flags().BoolP("cvInfo", "i", false, "Get all the info of all the cvs") + if err := rootCmd.Execute(); err != nil { + os.Exit(1) + } } diff --git a/internal/adapters/input/cli.go b/internal/adapters/input/cli.go index 36e0d4b..11475e3 100644 --- a/internal/adapters/input/cli.go +++ b/internal/adapters/input/cli.go @@ -22,3 +22,9 @@ func GenerateCVFromMarkDownToLatex(root string) error { func ChangeOverflowThreshold(newThreshold int) { core.SetOverflowThreshold(newThreshold) } +// Print info in the prompt for all the cvs +func PrintAllCvs(root string) { + source := MarkdownSource{} + core.GetInfoAllCvs(root,&source) +} + diff --git a/internal/adapters/output/latex_writer.go b/internal/adapters/output/latex_writer.go index 601dae6..f907122 100644 --- a/internal/adapters/output/latex_writer.go +++ b/internal/adapters/output/latex_writer.go @@ -32,7 +32,7 @@ func (*LatexReader) ReadCVTemplate(root string, params core.Params) (string, err return ApplyInfoToTemplate(string(file), params), nil } -// Apply general information(name, mail..) to a template +// Apply general information(name, mail...) to a template func ApplyInfoToTemplate(template string, params core.Params) string { var varsBuilder strings.Builder infoValue := reflect.ValueOf(params.Info) diff --git a/internal/core/generate.go b/internal/core/generate.go index 6e68617..9fc4261 100644 --- a/internal/core/generate.go +++ b/internal/core/generate.go @@ -237,6 +237,17 @@ func (s *BuilderService) GetService() CVService { } } +//Get all info of the cvs and prompt them in the stdout +func GetInfoAllCvs(root string, source Source){ + cvs, err := source.GetCVsFrom(root) + if err != nil{ + slog.Warn(err.Error()) + } + for _,cv := range cvs{ + cv.Print() + } +} + // Set the threshold value dynamically func SetOverflowThreshold(newThreshold int) { TresholdPageOverFlow.mutex.Lock() diff --git a/params.yml b/params.yml index 1ec0eaa..959cf2f 100644 --- a/params.yml +++ b/params.yml @@ -3,8 +3,8 @@ info: firstname: Vincent number: "+33 42 42 42 42 42" mail: vincent.anemon@example.com - github: vanemon - linkedin: vincent-anemon-linkedin + github: https://github.com/anemon + linkedin: https://www.linkedin.com/anemon variante: webDev: