Commit ad7de8d907a8f1a02d6449c9795f79a11d74d1b5

Stefan Sperling 2018-04-30T14:33:28

tog(1): improve "unknown command" error message

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/tog/tog.c b/tog/tog.c
index 2b977a1..c31cd3f 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -519,11 +519,12 @@ main(int argc, char *argv[])
 				if (error == NULL)
 					got_repo_close(repo);
 			} else
-				error = got_error(GOT_ERR_NOT_GIT_REPO);
+				error = got_error_from_errno();
 			if (error) {
-				free(repo_path);
-				fprintf(stderr, "%s: unknown command '%s'\n",
+				fprintf(stderr, "%s: '%s' is neither a known "
+				    "command nor a path to a repository\n",
 				    getprogname(), argv[0]);
+				free(repo_path);
 				return 1;
 			}
 			cmd = &tog_commands[0];