-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9fb72da
commit e5c6596
Showing
7 changed files
with
67 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters