Skip to content

Commit

Permalink
Windows specific newlines is now a default feature
Browse files Browse the repository at this point in the history
The feature is named `win_crlf`
Fixes #33
  • Loading branch information
Pierre-Henri Symoneaux committed Sep 11, 2016
1 parent bee55a1 commit 65212fe
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
13 changes: 5 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
language: rust
rust:
- stable
- beta
- nightly
# matrix:
# allow_failures:
# - rust: nightly
- stable
- beta
- nightly
env:
global:
- secure: M+X/Y/0FmtXj18pp2WI4KRyHx+C9B8ITxyfoIOY7sXu+zI06hmmWbawQSpKRzQY3KhTxXAXw7DMtsLlyHioz3w4iIoFykhai6DrUQWDocagPwvVA6hWf+mW7j3DiFlfx/0VT9JMi6Y0RyUcvo1e2snFKI9zQP20EOwK8IIyWUcwFks2Fpu1Hu3Bu8bw9lB3D6ZdzxbAuctcy+OuMR7OD6QFyHi8jQ2Q3yUruh3yLqy30bJSD3Nerw+PuwKiDX2tnObNUVRT0W0IQx6Yvk5sA7m+IZf2VM2ayKw6ChLdDC9yOa/s0mNzHBT7rE1HGfkYIsgc9kos2zZP5fMawDELpEDccPq19DYsno2gb7zFj7fyTFJbkqlROoj6cgL4xkBQAY/yRpnMzHhwLV1tu2lOJCdhyujCImb+mAZV14U7fkCAzYUrtxfdNImp88QQgynRC74vOAJc6qHnRI0ut6DoKcNqK+nn07spPY0wrAD4F+o7Nc32JcfJJ/YW7QvJBsWi6IdSduKvJyWTFtFLnLUzjsFT+C0U2P8dykOf1C4gxdUdUnxwSMDPC4+8VZlcqjPowjQ2xqS04TRKx45SEUDuX2xM0E2r8pIZpxNUm/NP1bwgumO0zMJCLEsIYe561BLODyOjmmsW2YVg2WOdpJWGh+Mbzr6aDu3B4FO4PbjZdEoI=
- secure: uEDWqegkGvkCo9qE5h3j/VvD007MKjwfsX9+CiWKK+nd+FrfqUak/LpSJiLYAdXePMqh/+jYynUWKsZFiLksmSkJK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sl+FRMH5BPMDlgDM4Ohp1+JRq0Mfu1qT6hoYXb+AoRvHijw9HoqtaU2lTamuSN6+LFNJ0CDt2Qhy4jn+Dmp5ZlivcUVzpQpdZoPG00BnLK6YfYoCF9gFX194TM2T6ljhYGaL7ITZI9Cz4qMxD3r459aGz8sUAcTkSbTRMGpTb4fJVfvCgsP2IDfKO7WS/W4SbCzYMh7PfpQg03BAvld0y69O8=
- secure: sF8l0788UwTlEjw+ctKwiw+73zLErGuah6Oh/zYjogwms27HDR7JxrWVXc/dvogwP0nuKoj5m8g4sbtIRkQDZ80OjEr1kefoE71fNDskDYXe4+lTP/RVHF4myTjVZ0HbrHLhiNzpP7NzzCURuOsXa6RGN7A6tSnpX5MZ7euW1HxF9Vjjebsrpko86AJbDESaJaBrFf40P+BJ0xKEEaygtAtnoYMEmSXzAAmOb6SAyDRx8do7433P6At2AEOTuUAocl/nefb36X4aEVfPPd23PVR1wICZmn1LwYccXbGZmW7OvhgU82P9Lb4SgsQtcDJdzOsH0yjsTimf/EDESLQhcD35MDGMUvL0nZ/sOWuTigZw8ax1CLna2kbxYwhZ3lfA8hqt9dkjzi6lwRRSP1CZD0YmaBA0S6H9zcmBdv551wn4nCGu4+uCYcvhqHh6cSZZGTSgiCZ3zr59TeMvAV5Fy3up4IhSYwrQYuPeZ3Wzzm3UEvGaTfmcgIEyqxRfBobNxzQI0I5PcvfXleHxuuOlZiMDFNQEO/dw5pbMaUdABggc0AR6Ph8dmScX3iCfuhzlErUFwNWGEifoojNquuj3+4FOkoAJ3hwqw+hdK3DS7cI2EFjTO9f6bBD72bbeo8lIylrbJo5KDAeIPzs0q1PX2s4DlSoRV39LggSaeZt/xAA=
after_success: |
sudo apt-get install libcurl4-openssl-dev libelf-dev libdw-dev &&
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz &&
Expand Down
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

name = "prettytable-rs"
version = "0.6.2"
version = "0.6.3"
description = "A library for printing pretty formatted tables in terminal"
homepage = "https://github.com/phsym/prettytable-rs"
repository = "https://github.com/phsym/prettytable-rs"
Expand All @@ -11,6 +11,10 @@ authors = [ "Pierre-Henri Symoneaux" ]
keywords = ["tab", "table", "format", "pretty", "print"]
license = "BSD-3-Clause"

[features]
default = ["win_crlf"]
win_crlf = []

[[bin]]
name = "main"

Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,13 @@ Value three | Value four

Check API documentation for the full list of available predefined formats.

## Note on line endings
By default, the library prints tables with platform specific line ending. Thin means on Windows,
newlines will be rendered with `\r\n` while on other platforms they will be rendered with `\n`.
Since `v0.6.3`, platform specific line endings are activated though the default feature `win_crlf`, which can be deactivated.
When this feature is deactivated (for instance with the `--no-default-features` flag in cargo), line endings will be rendered with `\n`
on any platform.

This customization capability will probably move to Formatting API in `v0.7`.

Additional examples are provided in the documentation and in [examples](./examples/) directory.
4 changes: 2 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use unicode_width::UnicodeWidthStr;

use super::format::Alignment;

#[cfg(not(windows))]
#[cfg(any(not(windows), not(feature="win_crlf")))]
pub static NEWLINE: &'static [u8] = b"\n";
#[cfg(windows)]
#[cfg(all(windows, feature="win_crlf"))]
pub static NEWLINE: &'static [u8] = b"\r\n";

/// Internal utility for writing data into a string
Expand Down

0 comments on commit 65212fe

Please sign in to comment.