From 5c90280037ef3d2e3f64e6248832bde5f9fe5bff Mon Sep 17 00:00:00 2001 From: kevinnls Date: Wed, 14 Jan 2026 23:16:50 +0530 Subject: [PATCH] fix man; include built man in repo --- Makefile | 20 +++++++++----------- README.md | 4 ++++ man/args.1 | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 11 deletions(-) create mode 100644 man/args.1 diff --git a/Makefile b/Makefile index 661e9ad..e422121 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,14 @@ ifneq "$(wildcard src/*.h)" '' HEADERS = $(wildcard src/*.h) endif +ifeq "$(shell id -u)" '0' + PREFIX := /usr/local +else + PREFIX := $(HOME)/.local +endif + define DOCS - $(subst docs/, build/man/, + $(subst docs/, man/, $(patsubst %.md, %, $(wildcard docs/*.md) @@ -21,17 +27,9 @@ build: build/ build/$(NAME) build/$(NAME): src/main.c $(HEADERS) cc -o $@ $< -define PREFIX -ifeq $(UID) 0 - /usr/local -else - $(HOME)/.local -endif -endef - install: install -CDm0755 -t $(PREFIX)/bin/ build/$(NAME) - install -CDm0644 -t $(PREFIX)/share/man/man1 build/$(NAME) + install -CDm0644 -t $(PREFIX)/share/man/man1 man/$(NAME).1 test: $(error testing using `make' not supported; use `just') @@ -39,7 +37,7 @@ test: docs: make $(strip $(DOCS)) -build/man/%: docs/%.md build/man/ docs/ +man/%: docs/%.md man/ pandoc --to man \ --standalone \ --output $@ \ diff --git a/README.md b/README.md index b5b0413..53ed141 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,10 @@ $ args "$(echo hello \"world\")" ``` ## how do i install it? +## requirements +- gcc +- make + ```console $ cd [a reasonable place] $ # |_ personally i create and use ~/.local/src diff --git a/man/args.1 b/man/args.1 new file mode 100644 index 0000000..e3d1d87 --- /dev/null +++ b/man/args.1 @@ -0,0 +1,54 @@ +.\" Automatically generated by Pandoc 3.6.4 +.\" +.TH "args" "1" "" "" +.SH SYNOPSIS +args ARGUMENT \&... +.SH DESCRIPTION +\f[B]args\f[R] separately prints to standard output each argument it +receives with its position. +.PP +The intended use of this tool is to help understand word splitting and +quote removal by the shell. +.PP +Each argument prints one line of output in the following format. +.IP +.EX + \[at][POSITION] [ARGUMENT] +.EE +.PP +The two fields are separated by a single tab character. +.PP +In case an empty string is received as an argument, it is represented as +follows for clarity. +These quotes are not the actual input. +Quotes would normally be removed by the shell before the command\[cq]s +execution. +.IP +.EX + \[at]1 \[aq]\[aq] +.EE +.SH EXAMPLE +.IP +.EX +$ args one two \[dq]\[dq] \[dq]word with spaces\[dq] $(echo substituted command) +\[at]1 one +\[at]2 two +\[at]3 \[aq]\[aq] +\[at]4 word with spaces +\[at]5 substituted +\[at]6 command +.EE +.PP +If \[at]5 and \[at]6 surprised you, finding cases like these and playing +around is the exact reason this tool exists. +.SH EXIT CODES +0 Success +.PP +1 Failed because no arguments were received +.SH LICENSE +This software is distributed under the license specified in +\f[CR]LICENSE.txt\f[R] +.SH AUTHORS +Kevin Samuel \c +.MT developer@kevinnlsamuel.com +.ME \c.