This is simple Swift library for formatting text tables.
let table = AsciiTable(labels: ["endpoint", "allowed methods", "content-type"])
table.add(["/warhouse", "POST", "application/json"])
table.add(["/shop", "GET", "text/html"])
table.add(["/order", "POST", "application/json"])
table.add(["/admin/auth/v1/token", "GET", "application/json"])
print(table)Output:
╒════════════════════════╤══════════════════╤═══════════════════╕
│  endpoint              │ allowed methods  │ content-type      │
╞════════════════════════╪══════════════════╪═══════════════════╡
│  /warhouse             │ POST             │ application/json  │
│  /shop                 │ GET              │ text/html         │
│  /order                │ POST             │ application/json  │
│  /admin/auth/v1/token  │ GET              │ application/json  │
└────────────────────────┴──────────────────┴───────────────────┘
You can configure border style and header divider style.
With double header divider:
╒════════════════════════╤══════════════════╤═══════════════════╕
│  endpoint              │ allowed methods  │ content-type      │
╞════════════════════════╪══════════════════╪═══════════════════╡
│  /warhouse             │ POST             │ application/json  │
│  /shop                 │ GET              │ text/html         │
│  /admin/auth/v1/token  │ GET              │ application/json  │
└────────────────────────┴──────────────────┴───────────────────┘
With single header divider:
╒════════════════════════╤══════════════════╤═══════════════════╕
│  endpoint              │ allowed methods  │ content-type      │
├────────────────────────┼──────────────────┼───────────────────┤
│  /warhouse             │ POST             │ application/json  │
│  /shop                 │ GET              │ text/html         │
│  /admin/auth/v1/token  │ GET              │ application/json  │
└────────────────────────┴──────────────────┴───────────────────┘
With double header divider:
┌────────────────────────┬──────────────────┬───────────────────┐
│  endpoint              │ allowed methods  │ content-type      │
╞════════════════════════╪══════════════════╪═══════════════════╡
│  /warhouse             │ POST             │ application/json  │
│  /shop                 │ GET              │ text/html         │
│  /admin/auth/v1/token  │ GET              │ application/json  │
└────────────────────────┴──────────────────┴───────────────────┘
With single header divider:
┌────────────────────────┬──────────────────┬───────────────────┐
│  endpoint              │ allowed methods  │ content-type      │
├────────────────────────┼──────────────────┼───────────────────┤
│  /warhouse             │ POST             │ application/json  │
│  /shop                 │ GET              │ text/html         │
│  /admin/auth/v1/token  │ GET              │ application/json  │
└────────────────────────┴──────────────────┴───────────────────┘
With double header divider:
╔════════════════════════╤══════════════════╤═══════════════════╗
║  endpoint              │ allowed methods  │ content-type      ║
╠════════════════════════╪══════════════════╪═══════════════════╣
║  /warhouse             │ POST             │ application/json  ║
║  /shop                 │ GET              │ text/html         ║
║  /admin/auth/v1/token  │ GET              │ application/json  ║
╚════════════════════════╧══════════════════╧═══════════════════╝
With single header divider:
╔════════════════════════╤══════════════════╤═══════════════════╗
║  endpoint              │ allowed methods  │ content-type      ║
╟────────────────────────┼──────────────────┼───────────────────╢
║  /warhouse             │ POST             │ application/json  ║
║  /shop                 │ GET              │ text/html         ║
║  /admin/auth/v1/token  │ GET              │ application/json  ║
╚════════════════════════╧══════════════════╧═══════════════════╝
With double header divider:
   endpoint              │ allowed methods  │ content-type       
 ════════════════════════╪══════════════════╪═══════════════════ 
   /warhouse             │ POST             │ application/json   
   /shop                 │ GET              │ text/html         
   /admin/auth/v1/token  │ GET              │ application/json   
With single header divider:
   endpoint              │ allowed methods  │ content-type       
 ────────────────────────┼──────────────────┼─────────────────── 
   /warhouse             │ POST             │ application/json   
   /shop                 │ GET              │ text/html          
   /admin/auth/v1/token  │ GET              │ application/json
You can add horizontal lines between rows with .addDivider() or .addDoubleDivider()
Sample code:
let table = AsciiTable(labels: ["endpoint", "allowed methods", "content-type"],
                       borderStyle: .popular,
                       headerDivider: .double)
table.add(["/warhouse", "POST", "application/json"])
table.addDivider()
table.add(["/shop", "GET", "text/html"])
table.addDivider()
table.add(["/admin/auth/v1/token", "GET", "application/json"])
print(table)Output:
╒════════════════════════╤══════════════════╤═══════════════════╕
│  endpoint              │ allowed methods  │ content-type      │
╞════════════════════════╪══════════════════╪═══════════════════╡
│  /warhouse             │ POST             │ application/json  │
├────────────────────────┼──────────────────┼───────────────────┤
│  /shop                 │ GET              │ text/html         │
├────────────────────────┼──────────────────┼───────────────────┤
│  /admin/auth/v1/token  │ GET              │ application/json  │
└────────────────────────┴──────────────────┴───────────────────┘
import PackageDescription
let package = Package(
    name: "MyServer",
    dependencies: [
        .package(url: "https://github.com/tomieq/AsciiTable", from: "2.0.0")
    ]
)in the target:
    targets: [
        .executableTarget(
            name: "AppName",
            dependencies: [
                .product(name: "AsciiTable", package: "AsciiTable")
            ])
    ]