fix man; include built man in repo

This commit is contained in:
2026-01-14 23:16:50 +05:30
parent 7b07cb8bc6
commit 5c90280037
3 changed files with 67 additions and 11 deletions

View File

@@ -7,8 +7,14 @@ ifneq "$(wildcard src/*.h)" ''
HEADERS = $(wildcard src/*.h) HEADERS = $(wildcard src/*.h)
endif endif
ifeq "$(shell id -u)" '0'
PREFIX := /usr/local
else
PREFIX := $(HOME)/.local
endif
define DOCS define DOCS
$(subst docs/, build/man/, $(subst docs/, man/,
$(patsubst $(patsubst
%.md, %, %.md, %,
$(wildcard docs/*.md) $(wildcard docs/*.md)
@@ -21,17 +27,9 @@ build: build/ build/$(NAME)
build/$(NAME): src/main.c $(HEADERS) build/$(NAME): src/main.c $(HEADERS)
cc -o $@ $< cc -o $@ $<
define PREFIX
ifeq $(UID) 0
/usr/local
else
$(HOME)/.local
endif
endef
install: install:
install -CDm0755 -t $(PREFIX)/bin/ build/$(NAME) 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: test:
$(error testing using `make' not supported; use `just') $(error testing using `make' not supported; use `just')
@@ -39,7 +37,7 @@ test:
docs: docs:
make $(strip $(DOCS)) make $(strip $(DOCS))
build/man/%: docs/%.md build/man/ docs/ man/%: docs/%.md man/
pandoc --to man \ pandoc --to man \
--standalone \ --standalone \
--output $@ \ --output $@ \

View File

@@ -35,6 +35,10 @@ $ args "$(echo hello \"world\")"
``` ```
## how do i install it? ## how do i install it?
## requirements
- gcc
- make
```console ```console
$ cd [a reasonable place] $ cd [a reasonable place]
$ # |_ personally i create and use ~/.local/src $ # |_ personally i create and use ~/.local/src

54
man/args.1 Normal file
View File

@@ -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.