Skip to content

Commit c52ba16

Browse files
committed
🌅
0 parents  commit c52ba16

File tree

7 files changed

+994
-0
lines changed

7 files changed

+994
-0
lines changed

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/

‎LICENSE‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2+
Version 2, December 2004
3+
4+
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
5+
6+
Everyone is permitted to copy and distribute verbatim or modified
7+
copies of this license document, and changing it is allowed as long
8+
as the name is changed.
9+
10+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12+
13+
0. You just DO WHAT THE FUCK YOU WANT TO.

‎Makefile‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.PHONY: install all clean
2+
PREFIX ?= /usr
3+
4+
all:
5+
./build-manpages
6+
7+
install:
8+
find build/ -name "*.7" -type f -print0 | xargs -0 gzip --keep -f
9+
install -D -m0644 ./build/*.7.gz $(DESTDIR)$(PREFIX)/share/man/man7/
10+
11+
clean:
12+
rm -rf build/*

‎README.md‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# HTTP Status Code Manual
2+
3+
This is exactly like [statcode](https://github.com/shobrook/statcode), but real manpages instead of a python package.
4+
5+
# Usage
6+
7+
```
8+
$ man 404
9+
```
10+
11+
The man pages are installed in category 7 — _Miscellaneous (including macro packages and conventions)_ — so you can also do:
12+
13+
```
14+
$ man 7 500
15+
```
16+
17+
# Installing
18+
19+
You need ruby to generate the man pages, after this you just need the manpage reader.
20+
21+
```
22+
$ make install
23+
```
24+
25+
# Installing on ArchLinux
26+
27+
```
28+
yay -S http-status-code-manpages
29+
```
30+
31+
## Contributing
32+
33+
1. Fork it (<https://github.com/hugopl/http-status-code-manpages/fork>)
34+
2. Create your feature branch (`git checkout -b my-new-feature`)
35+
3. Commit your changes (`git commit -am 'Add some feature'`)
36+
4. Push to the branch (`git push origin my-new-feature`)
37+
5. Create a new Pull Request
38+
39+
Any ideas/suggestions, fill in an issue.
40+
41+
## Contributors
42+
43+
- [Hugo Parente Lima](https://github.com/hugopl) - creator and maintainer

‎build-manpages‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require "yaml"
5+
require "fileutils"
6+
require "ap"
7+
8+
TEMPLATE = <<-EOF
9+
.\\" Copyright © CC BY-SA Mozilla Contributors <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status>
10+
.\\"
11+
.\\" Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply.
12+
.\\" Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.
13+
.\\"
14+
.TH %{code} 7 "" "" "HTTP Status Code Manual"
15+
.SH CODE
16+
%{code} \- %{message}
17+
.SH CATEGORY
18+
%{category}
19+
.SH DESCRIPTION
20+
%{description}
21+
EOF
22+
23+
BUILD_DIR = "./build"
24+
FileUtils.mkdir_p(BUILD_DIR)
25+
26+
codes = YAML.safe_load(File.read("./data/code_descriptions.yml"))
27+
codes.each do |code, info|
28+
info = info.transform_keys!(&:to_sym)
29+
info[:code] = code
30+
File.open("#{BUILD_DIR}/#{code}.7", "w") do |f|
31+
f.printf(TEMPLATE, info)
32+
end
33+
end
34+
puts "#{codes.size} man pages created at #{BUILD_DIR}."

0 commit comments

Comments
 (0)