Skip to content

Commit

Permalink
make flags mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufmalikul committed Sep 11, 2022
1 parent 6e77113 commit a9cb792
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ import (
)

func init() {
rootCmd.Flags().String("content", "content", "Content directory")
rootCmd.Flags().String("layouts", "layouts", "Layouts directory")
rootCmd.Flags().String("output", "output", "Output directory")
rootCmd.Flags().String("content", "", "Content directory")
rootCmd.Flags().String("layouts", "", "Layouts directory")
rootCmd.Flags().String("output", "", "Output directory")
rootCmd.MarkFlagRequired("content")
rootCmd.MarkFlagRequired("layouts")
rootCmd.MarkFlagRequired("output")
}

var rootCmd = &cobra.Command{
Use: "bloggy",
Short: "Bloggy is a simple and stup*d blog generator",
Long: `A simple and stup*d blog generator written in Go.`,
Long: `A simple and stup*d static blog generator written in Go (https://github.com/yusufmalikul/bloggy).`,
Run: func(cmd *cobra.Command, args []string) {

// get flags
Expand Down

0 comments on commit a9cb792

Please sign in to comment.