Added a flag called 'generate-config' which will generate default config files.
This commit is contained in:
		
							
								
								
									
										7
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								main.go
									
									
									
									
									
								
							@@ -2,6 +2,7 @@ package main
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
 | 
						"flag"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
@@ -59,6 +60,12 @@ func printFile(fileName string) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func main() {
 | 
					func main() {
 | 
				
			||||||
 | 
						generateConfigFlag := flag.Bool("generate-config", false, "Generate default config files")
 | 
				
			||||||
 | 
						flag.Parse()
 | 
				
			||||||
 | 
						if *generateConfigFlag {
 | 
				
			||||||
 | 
							generateDefaultConfigs()
 | 
				
			||||||
 | 
							os.Exit(0)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Check if user has provided a file name
 | 
						// Check if user has provided a file name
 | 
				
			||||||
	if len(os.Args) != 2 {
 | 
						if len(os.Args) != 2 {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user