 private struct TextTableColumn {
     let header: String
     let values: [String]
+    let maxWidth: Int?
+
+    init(header: String, values: [String], maxWidth: Int? = nil) {
+        self.header = header
+        self.values = values
+        self.maxWidth = maxWidth
+    }
 
     var width: Int {
-        return max(header.characters.count, values.reduce(0) { max($0, $1.characters.count) })
+        let maxValuesWidth = values.reduce(0) { max($0, $1.characters.count) }
+        let maxContentWidth = max(header.characters.count, maxValuesWidth)
+        return min(maxWidth ?? maxContentWidth, maxContentWidth)
     }
 }
 

    return separator + strings.joinWithSeparator(separator) + separator
}

private struct TextTable {
    let columns: [TextTableColumn]

    func render() -> String {
        let joint = "+"
        let verticalSeparator = "|"
        let horizontalSeparator = "-"
        let separator = fence(columns.map({ column in
            Repeat(count: column.width + 2, repeatedValue: horizontalSeparator)
                .joinWithSeparator("")
        }), separator: joint)
        let header = fence(columns.map({ " \($0.header.withPadding($0.width)) " }),
            separator: verticalSeparator)
        let values = (0..<columns.first!.values.count).map({ rowIndex in
            fence(columns.map({ column in
                " \(column.values[rowIndex].withPadding(column.width)) "
            }), separator: verticalSeparator)
        }).joinWithSeparator("\n")
        return [separator, header, separator, values, separator].joinWithSeparator("\n")
    }

        let sortedRules = masterRuleList.list.sort { $0.0 < $1.0 }
        let table = TextTable(columns: [
            TextTableColumn(header: "identifier", values: sortedRules.map({ $0.0 })),
            TextTableColumn(header: "opt-in",
                values: sortedRules.map({ ($0.1.init() is OptInRule) ? "yes" : "no" })),
            TextTableColumn(header: "description",
                values: sortedRules.map({ $0.1.description.description }), maxWidth: 100)
        ])
        print(table.render())
        return .Success()
