Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor terminal support #35

Merged
merged 9 commits into from
Aug 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
### Added
- `mdcat` builds on Windows now (see [GH-34][]).

### Changed
- Refactor internal terminal representation, replacing the terminal enum with a
new `Terminal` trait and dynamic dispatch.
- Only include terminal backends supported on the platform.

[GH-34]: https://github.com/lunaryorn/mdcat/pull/34

## [0.8.0] – 2018-02-15
Expand Down
18 changes: 11 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,29 @@ version = "0.8.1-pre"
categories = ["command-line-utilities", "text-processing"]
license = "Apache-2.0"
authors = ["Sebastian Wiesner <sebastian@swsnr.de>"]
build = "build.rs"

[badges]
travis-ci = { repository = "lunaryorn/mdcat" }
maintenance = { status = "actively-developed" }

[features]
default = []

iterm2 = ["mime", "base64"]
terminology = ["immeta"]

[dependencies]
atty = "^0.2"
failure = "^0.1"
reqwest = "^0.8"
term_size = "^0.3"
url = "^1.6"

mime = {version = "^0.3", optional = true}
base64 = {version = "^0.9", optional = true}
immeta = {version = "^0.4", optional = true}

[dependencies.clap]
version = "^2.29"
default-features = false
Expand All @@ -37,13 +48,6 @@ version = "^2"
default-features = false
features = ["parsing", "assets", "dump-load"]

[target.'cfg(target_os = "macos")'.dependencies]
mime = "^0.3"
base64 = "^0.9"

[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
immeta = "^0.4"

[package.metadata.release]
sign-commit = true
upload-doc = false
Expand Down
28 changes: 28 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2018 Sebastian Wiesner <sebastian@swsnr.de>

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

fn enable_feature(feature: &str) {
println!("rustc-cfg={}", feature);
}

fn main() {
#[cfg(target_os = "macos")]
{
enable_feature("iterm2");
}
#[cfg(all(unix, not(target_os = "macos")))]
{
enable_feature("terminology");
}
}
Loading