summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--bin/hi.c6
-rw-r--r--bin/man1/hi.17
2 files changed, 10 insertions, 3 deletions
diff --git a/bin/hi.c b/bin/hi.c
index ec1a85ee..c8533e55 100644
--- a/bin/hi.c
+++ b/bin/hi.c
@@ -668,13 +668,14 @@ static bool findFormat(struct Format *format, const char *name) {
 int main(int argc, char *argv[]) {
 	setlocale(LC_CTYPE, "");
 
+	bool text = false;
 	const char *name = NULL;
 	struct Language lang = {0};
 	struct Format format = Formats[0];
 	const char *opts[OptionLen] = {0};
 
 	int opt;
-	while (0 < (opt = getopt(argc, argv, "cf:l:n:o:"))) {
+	while (0 < (opt = getopt(argc, argv, "cf:l:n:o:t"))) {
 		switch (opt) {
 			break; case 'c': check(); return EX_OK;
 			break; case 'f': {
@@ -699,6 +700,7 @@ int main(int argc, char *argv[]) {
 					opts[key] = (val ? val : "");
 				}
 			}
+			break; case 't': text = true;
 			break; default: return EX_USAGE;
 		}
 	}
@@ -715,7 +717,7 @@ int main(int argc, char *argv[]) {
 		name = strrchr(path, '/');
 		name = (name ? &name[1] : path);
 	}
-	if (!lang.name && !matchLanguage(&lang, name)) {
+	if (!lang.name && !matchLanguage(&lang, name) && !text) {
 		errx(EX_USAGE, "cannot infer language for %s", name);
 	}
 	if (!opts[Title]) opts[Title] = name;
diff --git a/bin/man1/hi.1 b/bin/man1/hi.1
index d8a4b4ee..517fbab9 100644
--- a/bin/man1/hi.1
+++ b/bin/man1/hi.1
@@ -1,4 +1,4 @@
-.Dd December 11, 2019
+.Dd December 15, 2019
 .Dt HI 1
 .Os
 .
@@ -8,6 +8,7 @@
 .
 .Sh SYNOPSIS
 .Nm
+.Op Fl t
 .Op Fl f Ar format
 .Op Fl l Ar lang
 .Op Fl n Ar name
@@ -40,6 +41,10 @@ to infer the input language.
 Set output format options.
 .Ar opts
 is a comma-separated list of options.
+.It Fl t
+Default to
+.Cm text
+if the input language cannot be inferred.
 .El
 .
 .Ss Output Formats
a href='/src/commit/www/temp.causal.agency/up.c?id=bd4afa842d5893a54ba9525bb7c9a2c691ec6325&follow=1'>Call sandbox in CGI modeJune McEnroe 2021-09-22Support HTTP PUT in upJune McEnroe 2021-09-22Remove default faviconJune McEnroe 2021-09-21Use Z_FILTERED strategyJune McEnroe 2021-09-21Recalculate various lengths only as neededJune McEnroe 2021-09-21Rewrite pngo, add explicit optionsJune McEnroe 2021-09-16Fix /* **/ comment matchingJune McEnroe 2021-09-15Remove typer, add downgrade to READMEJune McEnroe 2021-09-15Set bot mode on downgradeJune McEnroe 2021-09-15Enter capsicum in downgradeJune McEnroe 2021-09-15Factor out common parts of downgrade messagesJune McEnroe 2021-09-14Add downgrade IRC botJune McEnroe 2021-09-14Sort by title if authors matchJune McEnroe 2021-09-13Swap-remove tags as they're foundJune McEnroe 2021-09-12Replace htagml regex with strncmpJune McEnroe 2021-09-11Also defer printing comment for lone close-parensJune McEnroe 2021-09-10Publish "git-comment"June McEnroe 2021-09-10Add git comment --pretty optionJune McEnroe 2021-09-08Defer printing comment if line is blank or closing braceJune McEnroe 2021-09-08Up default min-repeat to 30 linesJune McEnroe 2021-09-08Handle dirty lines in git-commentJune McEnroe 2021-09-08Document and install git-commentJune McEnroe 2021-09-08Add repeat and all options to git-commentJune McEnroe 2021-09-08Add group threshold to git-commentJune McEnroe