printUsage.go 745 B

12345678910111213141516171819202122232425262728
  1. package flags
  2. import (
  3. "flag"
  4. "fmt"
  5. "os"
  6. )
  7. // Validate if the char provided is 0-9
  8. func (flags *Flags) validChar(char rune) (valid bool) {
  9. decvals := [10]int{48, 49, 50, 51, 52, 53, 54, 55, 56, 57}
  10. for _, value := range decvals {
  11. if char == rune(value) {
  12. valid = true
  13. }
  14. }
  15. return
  16. }
  17. // Print help information for the end-user
  18. func (flags *Flags) printUsage() {
  19. fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
  20. fmt.Fprintf(flag.CommandLine.Output(), "\nPut every row of a Sudoku puzzle as paramters.\nUse '0' for what is currently blank in the puzzle you wish to solve.\n\n")
  21. fmt.Fprintf(flag.CommandLine.Output(), "Example: %s -row1 ... -row2 ... -row3 ... (etc)\n\n", os.Args[0])
  22. flag.PrintDefaults()
  23. }