summary refs log tree commit diff stats
path: root/grus.go
diff options
context:
space:
mode:
Diffstat (limited to 'grus.go')
-rw-r--r--grus.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/grus.go b/grus.go
index 7c17a98..f84d9a1 100644
--- a/grus.go
+++ b/grus.go
@@ -14,7 +14,7 @@ func grus() {
 		os.Exit(1)
 	}
 
-	version := "v0.2.0"
+	version := "v0.2.1"
 
 	if os.Args[1] == "version" {
 		fmt.Printf("Grus %s\n", version)
@@ -52,6 +52,14 @@ func grus() {
 		anagrams = true
 	}
 
+	// Check if user wants to print dictionary path.
+	printPath := false
+	printPathEnv := os.Getenv("GRUS_PRINT_PATH")
+	if printPathEnv == "true" ||
+		printPathEnv == "1" {
+		printPath = true
+	}
+
 	for _, dict := range dicts {
 		if _, err := os.Stat(dict); err != nil &&
 			!os.IsNotExist(err) {
@@ -66,6 +74,11 @@ func grus() {
 			continue
 		}
 
+		// Print path to dictionary if printPath is true.
+		if printPath {
+			fmt.Println(dict)
+		}
+
 		file, err := os.Open(dict)
 		panicOnErr(err)
 		defer file.Close()