diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | headers.1.in | 27 | ||||
-rwxr-xr-x | headers.lua | 6 |
3 files changed, 34 insertions, 3 deletions
@@ -6,6 +6,8 @@ BINDIR=$(PREFIX_EXEC)/bin DATADIR=$(PREFIX)/share LUA_LMOD=$(DATADIR)/lua/$(LUA_VERSION) HEADERS_DB=$(DATADIR)/headers +MANDIR=$(DATADIR)/man +MAN1DIR=$(MANDIR)/man1 all: test @@ -16,7 +18,9 @@ install: install -m755 -DT headers.lua $(DESTDIR)$(BINDIR)/headers install -m644 -Dt $(DESTDIR)$(LUA_LMOD)/headers headers/*.lua install -m644 -Dt $(DESTDIR)$(HEADERS_DB) db/*.lua + install -m644 -DT headers.1.in $(DESTDIR)$(MAN1DIR)/headers.1 sed -i 's|db/|$(HEADERS_DB)/|' $(DESTDIR)$(LUA_LMOD)/headers/default_path.lua + sed -i 's|@HEADERS_DB@|$(HEADERS_DB)|' $(DESTDIR)$(MAN1DIR)/headers.1 uninstall: rm -f $(DESTDIR)$(BINDIR)/headers diff --git a/headers.1.in b/headers.1.in new file mode 100644 index 0000000..661f2ca --- /dev/null +++ b/headers.1.in @@ -0,0 +1,27 @@ +.TH headers 1 "2024-08-26" +.SH NAME +headers - prints list of headers from one or more standards +.SH SYNOPSIS +.B headers +.RB [ \-d +.IR path ] +.RI [ standards ]... +.SH DESCRIPTION +Once called this script will scan standard database directory, parse its content and then perform action based on +command-line arguments. If any trailing +.I standards +were passed, the tool will print all headers from the selected standards. Otherwise a list of available standards will +be printed to standard output. +.P +Optionally, +.B -d +can be provided to change the default location where standard definitions are scanned. +.SH FILES +Default location with standard definitions is at +.IR @HEADERS_DB@ . +.SH ENVIRONMENT +In addition to +.B \-d +option, +.B HEADERS_DB_PATH +can be set in the environment to change the default location for standard definitions. diff --git a/headers.lua b/headers.lua index dc2c333..6254205 100755 --- a/headers.lua +++ b/headers.lua @@ -1,8 +1,8 @@ #!/usr/bin/env lua local args = require "pl.lapp" [[ -Prints list of headers from a standard or available standards - -d (optional string) Directory where definitions are placed - <selection...> (optional string) Standard to display the headers for +Prints list of headers from one or more standards + -d (optional string) Path to a custom standard definitions directory + <selection...> (optional string) Standards to display the headers for ]] local dir = require "pl.dir" local parser = require "headers.db".parse_all(args.d) |