aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShav Kinderlehrer <[email protected]>2023-04-17 23:58:23 -0400
committerShav Kinderlehrer <[email protected]>2023-04-18 00:00:40 -0400
commit0e1183a62cb98f52393961f7d40524f3754ec22e (patch)
treeb0ae6b86ee7ca6dd980ee1322e14dc68212bdb88
parent0247ecc2a1ddbf85cbd5f6912238a5753150341c (diff)
downloadlat-0e1183a62cb98f52393961f7d40524f3754ec22e.tar.gz
lat-0e1183a62cb98f52393961f7d40524f3754ec22e.zip
Update help messagev0.9.2
- add usage - add env - add description
-rw-r--r--include/arg.h2
-rw-r--r--src/lib/arg.c24
2 files changed, 20 insertions, 6 deletions
diff --git a/include/arg.h b/include/arg.h
index cd0a77a..138a44b 100644
--- a/include/arg.h
+++ b/include/arg.h
@@ -2,7 +2,7 @@
#define ARG_H
#include <stdbool.h>
-#define LAT_VERSION "0.9.1"
+#define LAT_VERSION "0.9.2"
struct config {
bool stdin;
diff --git a/src/lib/arg.c b/src/lib/arg.c
index 5437f99..6f4d714 100644
--- a/src/lib/arg.c
+++ b/src/lib/arg.c
@@ -5,10 +5,13 @@
#include "arg.h"
#include "util.h"
-#define LAT_USAGE "usage: lat [-cnbVh] [files..]"
+#define LAT_USAGE "usage: lat [-cntbVh] [file...]"
void help(void) {
- printf("%s\n", LAT_USAGE);
+ printf("lat | lazy cat - a cat clone with some quality-of-life "
+ "embelishments\n\n");
+
+ printf("%s\n\n", LAT_USAGE);
printf("options:\n"
"\t-c, --color\t toggle whether to print color or not\n"
"\t-n, --lines\t toggle whether to print line numbers or not\n"
@@ -16,8 +19,17 @@ void help(void) {
"\t-b, --binary\t toggle whether to force the data to be treated as "
"binary or not\n"
"\t-V, --version\t show program version\n"
- "\t-h, --help\t display this help text\n");
- printf("");
+ "\t-h, --help\t display this help text\n\n");
+ printf("environment:\n"
+ "\tNO_COLOR, see https://no-color.org/\n\n");
+ printf("examples:\n"
+ "\tlat file1\n\t\t print the content of file1 witht default formatting\n"
+ "\tlat - file1\n\t\t read from stdin (the '-' character reads from stdin) "
+ "and then print the contents of stdin and file1\n"
+ "\tlat -nc file1 file2\n\t\t print the contents of file1 and file2 "
+ "without printing line numbers or colors\n"
+ "\tcurl example.com | lat\n\t\t pipe the results of 'curl example.com' "
+ "into lat\n");
}
void version(void) {
@@ -26,8 +38,10 @@ void version(void) {
struct config conf;
void argerr(char *r, char *arg) {
- printf("lat: %s '%s'\n", r, arg);
+ printf("lat: %s '%s'\n\n", r, arg);
+
printf("%s\n", LAT_USAGE);
+ printf("run '--help' for more information\n");
exit(EXIT_FAILURE);
}