mirror of
https://github.com/lsd-rs/lsd
synced 2025-01-05 16:38:50 +00:00
Add a complete CD
This commit include the features: - The version is available with `lsd --version` - Create the completions scripts for bash/fish/zsh/powershell - Return an error during the build if the rust requirements are not ok. - Add the binaries into the releases assets - Fix Size for the i686 architectures
This commit is contained in:
parent
67261f7cef
commit
98bc907101
8 changed files with 371 additions and 54 deletions
121
.travis.yml
121
.travis.yml
|
@ -1,18 +1,117 @@
|
||||||
language: rust
|
language: rust
|
||||||
|
|
||||||
rust:
|
|
||||||
- stable
|
|
||||||
- beta
|
|
||||||
- nightly
|
|
||||||
|
|
||||||
sudo: false
|
|
||||||
cache: cargo
|
cache: cargo
|
||||||
|
sudo: false
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- rust: nightly
|
include:
|
||||||
fast_finish: true
|
# Stable channel.
|
||||||
|
- os: linux
|
||||||
|
rust: stable
|
||||||
|
env: TARGET=x86_64-unknown-linux-gnu
|
||||||
|
- os: linux
|
||||||
|
rust: stable
|
||||||
|
env: TARGET=i686-unknown-linux-gnu
|
||||||
|
- os: osx
|
||||||
|
rust: stable
|
||||||
|
env: TARGET=x86_64-apple-darwin
|
||||||
|
|
||||||
|
# Beta channel.
|
||||||
|
- os: linux
|
||||||
|
rust: beta
|
||||||
|
env: TARGET=x86_64-unknown-linux-gnu
|
||||||
|
# Disabled to reduce total CI time
|
||||||
|
# - os: linux
|
||||||
|
# rust: beta
|
||||||
|
# env: TARGET=i686-unknown-linux-gnu
|
||||||
|
# - os: osx
|
||||||
|
# rust: beta
|
||||||
|
# env: TARGET=x86_64-apple-darwin
|
||||||
|
|
||||||
|
# Nightly channel.
|
||||||
|
- os: linux
|
||||||
|
rust: nightly
|
||||||
|
env: TARGET=x86_64-unknown-linux-gnu
|
||||||
|
# Disabled to reduce total CI time
|
||||||
|
# - os: linux
|
||||||
|
# rust: nightly
|
||||||
|
# env: TARGET=i686-unknown-linux-gnu
|
||||||
|
# - os: osx
|
||||||
|
# rust: nightly
|
||||||
|
# env: TARGET=x86_64-apple-darwin
|
||||||
|
|
||||||
|
# Minimum Rust supported channel.
|
||||||
|
- os: linux
|
||||||
|
rust: 1.30.1
|
||||||
|
env: TARGET=x86_64-unknown-linux-gnu
|
||||||
|
- os: linux
|
||||||
|
rust: 1.30.1
|
||||||
|
env: TARGET=i686-unknown-linux-gnu
|
||||||
|
- os: osx
|
||||||
|
rust: 1.30.1
|
||||||
|
env: TARGET=x86_64-apple-darwin
|
||||||
|
|
||||||
|
# Code formatting check
|
||||||
|
- os: linux
|
||||||
|
rust: stable
|
||||||
|
# skip the global install step
|
||||||
|
install:
|
||||||
|
- rustup component add clippy-preview
|
||||||
|
script:
|
||||||
|
- cargo clippy
|
||||||
|
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
# needed for i686-unknown-linux-gnu target
|
||||||
|
- gcc-multilib
|
||||||
|
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
# Default target on travis-ci.
|
||||||
|
# Used as conditional check in the install stage
|
||||||
|
- HOST=x86_64-unknown-linux-gnu
|
||||||
|
# Used on the deployment script
|
||||||
|
- PROJECT_NAME=lsd
|
||||||
|
|
||||||
|
install:
|
||||||
|
# prevent target re-add error from rustup
|
||||||
|
- if [[ $TRAVIS_OS_NAME = linux && $HOST != $TARGET ]]; then rustup target add $TARGET; fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cargo build --verbose --all
|
# Incorporate TARGET env var to the build and test process
|
||||||
- cargo test --verbose --all
|
- cargo build --target $TARGET --verbose
|
||||||
|
- cargo test --target $TARGET --verbose
|
||||||
|
|
||||||
|
|
||||||
|
before_deploy:
|
||||||
|
- bash deploy/before_deploy.bash
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
provider: releases
|
||||||
|
# NOTE updating the `api_key.secure`
|
||||||
|
# - go to: https://github.com/settings/tokens/new
|
||||||
|
# - generate new token using `public_repo` scope
|
||||||
|
# - encrypt it using: `travis encrypt API_KEY_HERE`
|
||||||
|
# - paste the output below
|
||||||
|
api_key:
|
||||||
|
secure: "STYiKM9T5cHxIe9S0ocrXQAhxv6gsDbD0iv+EgrKZJCRGZQt/fPu2dx3PGeZXytHq/esigXQ/P76oQU2up4RDU1lh7OKhHBpKA239sTzGTT0oYQ6Rl8LVg2+6PxehYGuTqXUBpTccaOjmLKOI+p7cdm21PXjvu79myF8PJksLHwhTQkJLimTyZmjT1t1m1X6Nbwu9xEjixpa9JIlTyg+UESasPztV52/p1OUhv0koj5hQ2TJLQX5Sjt98C8Q/4fAPtlbUrwthcODZHhoaSGHYYDUHW7sNLx5P4/hYdKp+f+ycKQt59N+eEnTMFCuL4KDzl/X7ITfY6i48I2mHdEpADHF8D0bAu8AkWfbhUEp6345t7sTZyQOgB8Q8ODbIhaDvG8mgYRBJ7EWphE2E6AA7M9HEYSeGgN44z3HfVmny9UkJPwTOr8iYpsmO5hpEWisBeHqwsTPylVuHRa6NRrt4rDEBiJHDYCKPMiM3As6eebzSJ1FaOpMEvp5JghIlq6U4R+AxhnrH5/Hr990u9p6KQxFQ2L1dk+T0c5UH8B8WKbg5BzjbwdDclhAeAKHR56iyX8hCXYwGXty9BOtg7nowyss7smzGdItgJKIZjY2Hftz6GwiEyxQXYnktC9Lm465X89Ou4odEyjgdHsCb8YUWGCaCE0nK+JNySI/TN6EBfg="
|
||||||
|
|
||||||
|
# for uploading multiple files
|
||||||
|
file_glob: true
|
||||||
|
# NOTE explanation on each env variable
|
||||||
|
# - PROJECT_NAME: name of the project, set on the `env.global` above
|
||||||
|
# - TRAVIS_TAG: tag name that the build is being deployed for, usually the version number
|
||||||
|
# - TARGET: target triple of the build
|
||||||
|
file: $PROJECT_NAME-$TRAVIS_TAG-$TARGET.*
|
||||||
|
# don't delete artifacts from previous stage
|
||||||
|
skip_cleanup: true
|
||||||
|
on:
|
||||||
|
# deploy only if we push a tag
|
||||||
|
tags: true
|
||||||
|
# deploy only on stable channel that has TARGET env variable sets
|
||||||
|
condition: $TRAVIS_RUST_VERSION = stable && $TARGET != ""
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
email:
|
||||||
|
on_success: never
|
||||||
|
|
42
Cargo.lock
generated
42
Cargo.lock
generated
|
@ -30,11 +30,21 @@ dependencies = [
|
||||||
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kernel32-sys"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
version = "1.2.0"
|
version = "1.2.0"
|
||||||
|
@ -57,6 +67,7 @@ dependencies = [
|
||||||
"terminal_size 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"terminal_size 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"users 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"users 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -85,6 +96,16 @@ dependencies = [
|
||||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "term_size"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "terminal_size"
|
name = "terminal_size"
|
||||||
version = "0.1.8"
|
version = "0.1.8"
|
||||||
|
@ -109,6 +130,7 @@ name = "textwrap"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -140,6 +162,16 @@ name = "vec_map"
|
||||||
version = "0.8.1"
|
version = "0.8.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version_check"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi"
|
||||||
|
version = "0.2.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.3.6"
|
version = "0.3.6"
|
||||||
|
@ -149,6 +181,11 @@ dependencies = [
|
||||||
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-build"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi-i686-pc-windows-gnu"
|
name = "winapi-i686-pc-windows-gnu"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
@ -164,12 +201,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
|
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
|
||||||
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
|
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
|
||||||
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
|
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
|
||||||
|
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||||
"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
|
"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
|
||||||
"checksum libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)" = "10923947f84a519a45c8fefb7dd1b3e8c08747993381adee176d7a82b4195311"
|
"checksum libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)" = "10923947f84a519a45c8fefb7dd1b3e8c08747993381adee176d7a82b4195311"
|
||||||
"checksum redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "679da7508e9a6390aeaf7fbd02a800fdc64b73fe2204dd2c8ae66d22d9d5ad5d"
|
"checksum redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "679da7508e9a6390aeaf7fbd02a800fdc64b73fe2204dd2c8ae66d22d9d5ad5d"
|
||||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||||
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
|
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
|
||||||
"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf"
|
"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf"
|
||||||
|
"checksum term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327"
|
||||||
"checksum terminal_size 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "023345d35850b69849741bd9a5432aa35290e3d8eb76af8717026f270d1cf133"
|
"checksum terminal_size 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "023345d35850b69849741bd9a5432aa35290e3d8eb76af8717026f270d1cf133"
|
||||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||||
"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
|
"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
|
||||||
|
@ -177,6 +216,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
|
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
|
||||||
"checksum users 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fed7d0912567d35f88010c23dbaf865e9da8b5227295e8dc0f2fdd109155ab7"
|
"checksum users 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fed7d0912567d35f88010c23dbaf865e9da8b5227295e8dc0f2fdd109155ab7"
|
||||||
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
||||||
|
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
|
||||||
|
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||||
"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
|
"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
|
||||||
|
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
22
Cargo.toml
22
Cargo.toml
|
@ -1,5 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
authors = ["Peltoche <dev@halium.fr>"]
|
authors = ["Peltoche <dev@halium.fr>"]
|
||||||
|
build = "build.rs"
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
description = "A ls command with a lot of pretty colors."
|
description = "A ls command with a lot of pretty colors."
|
||||||
homepage = "https://github.com/Peltoche/lsd"
|
homepage = "https://github.com/Peltoche/lsd"
|
||||||
|
@ -10,9 +11,16 @@ readme = "./README.md"
|
||||||
repository = "https://github.com/Peltoche/lsd"
|
repository = "https://github.com/Peltoche/lsd"
|
||||||
version = "0.6.4-pre"
|
version = "0.6.4-pre"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "lsd"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
clap = "2.32.0"
|
||||||
|
version_check = "0.1.3"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ansi_term = "0.11.0"
|
ansi_term = "0.11.0"
|
||||||
clap = "2.32.0"
|
|
||||||
lazy_static = "1.2.0"
|
lazy_static = "1.2.0"
|
||||||
libc = "0.2.44"
|
libc = "0.2.44"
|
||||||
term_grid = "0.1.7"
|
term_grid = "0.1.7"
|
||||||
|
@ -20,12 +28,6 @@ terminal_size = "0.1.8"
|
||||||
time = "0.1.40"
|
time = "0.1.40"
|
||||||
users = "0.8.0"
|
users = "0.8.0"
|
||||||
|
|
||||||
[metadata]
|
[dependencies.clap]
|
||||||
|
version = "2.32.0"
|
||||||
[metadata.deb]
|
features = ["suggestions", "color", "wrap_help"]
|
||||||
assets = [["target/release/lsd", "usr/bin/", "755"], ["README.md", "usr/share/doc/cargo-deb/README", "644"]]
|
|
||||||
depends = "$auto"
|
|
||||||
license-file = ["LICENSE", "2"]
|
|
||||||
maintainer = "Peltoche <dev@halium.fr>"
|
|
||||||
priority = "optional"
|
|
||||||
section = "utility"
|
|
||||||
|
|
42
build.rs
Normal file
42
build.rs
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
// Copyright (c) 2017 fd developers
|
||||||
|
// Licensed under the Apache License, Version 2.0
|
||||||
|
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0>
|
||||||
|
// or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
|
||||||
|
// at your option. All files in the project carrying such
|
||||||
|
// notice may not be copied, modified, or distributed except
|
||||||
|
// according to those terms.
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
extern crate clap;
|
||||||
|
extern crate version_check;
|
||||||
|
|
||||||
|
use clap::Shell;
|
||||||
|
use std::fs;
|
||||||
|
use std::io::{self, Write};
|
||||||
|
use std::process::exit;
|
||||||
|
|
||||||
|
include!("src/app.rs");
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
match version_check::is_min_version("1.30.1") {
|
||||||
|
Some((true, _)) => {}
|
||||||
|
// rustc version too small or can't figure it out
|
||||||
|
_ => {
|
||||||
|
writeln!(&mut io::stderr(), "'lsd' requires rustc >= 1.30.1").unwrap();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let var = std::env::var_os("SHELL_COMPLETIONS_DIR").or(std::env::var_os("OUT_DIR"));
|
||||||
|
let outdir = match var {
|
||||||
|
None => return,
|
||||||
|
Some(outdir) => outdir,
|
||||||
|
};
|
||||||
|
fs::create_dir_all(&outdir).unwrap();
|
||||||
|
|
||||||
|
let mut app = build_app();
|
||||||
|
app.gen_completions("lsd", Shell::Bash, &outdir);
|
||||||
|
app.gen_completions("lsd", Shell::Fish, &outdir);
|
||||||
|
app.gen_completions("lsd", Shell::Zsh, &outdir);
|
||||||
|
app.gen_completions("lsd", Shell::PowerShell, &outdir);
|
||||||
|
}
|
125
deploy/before_deploy.bash
Normal file
125
deploy/before_deploy.bash
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Building and packaging for release
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cargo build --target "$TARGET" --release --verbose
|
||||||
|
}
|
||||||
|
|
||||||
|
pack() {
|
||||||
|
local tempdir
|
||||||
|
local out_dir
|
||||||
|
local package_name
|
||||||
|
local gcc_prefix
|
||||||
|
|
||||||
|
tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
||||||
|
out_dir=$(pwd)
|
||||||
|
package_name="$PROJECT_NAME-$TRAVIS_TAG-$TARGET"
|
||||||
|
|
||||||
|
if [[ $TARGET == arm-unknown-linux-* ]]; then
|
||||||
|
gcc_prefix="arm-linux-gnueabihf-"
|
||||||
|
else
|
||||||
|
gcc_prefix=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create a "staging" directory
|
||||||
|
mkdir "$tempdir/$package_name"
|
||||||
|
mkdir "$tempdir/$package_name/autocomplete"
|
||||||
|
|
||||||
|
# copying the main binary
|
||||||
|
cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"
|
||||||
|
"${gcc_prefix}"strip "$tempdir/$package_name/$PROJECT_NAME"
|
||||||
|
|
||||||
|
# manpage, readme and license
|
||||||
|
cp README.md "$tempdir/$package_name"
|
||||||
|
c LICENSE "$tempdir/$package_name"
|
||||||
|
|
||||||
|
# various autocomplete
|
||||||
|
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".bash "$tempdir/$package_name/autocomplete/${PROJECT_NAME}.bash-completion"
|
||||||
|
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".fish "$tempdir/$package_name/autocomplete"
|
||||||
|
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/_"$PROJECT_NAME" "$tempdir/$package_name/autocomplete"
|
||||||
|
|
||||||
|
# archiving
|
||||||
|
pushd "$tempdir"
|
||||||
|
tar czf "$out_dir/$package_name.tar.gz" "$package_name"/*
|
||||||
|
popd
|
||||||
|
rm -r "$tempdir"
|
||||||
|
}
|
||||||
|
|
||||||
|
make_deb() {
|
||||||
|
local tempdir
|
||||||
|
local architecture
|
||||||
|
local version
|
||||||
|
local dpkgname
|
||||||
|
local conflictname
|
||||||
|
|
||||||
|
case $TARGET in
|
||||||
|
x86_64*)
|
||||||
|
architecture=amd64
|
||||||
|
;;
|
||||||
|
i686*)
|
||||||
|
architecture=i386
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "make_deb: skipping target '${TARGET}'" >&2
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
version=${TRAVIS_TAG#v}
|
||||||
|
if [[ $TARGET = *musl* ]]; then
|
||||||
|
dpkgname=$PROJECT_NAME-musl
|
||||||
|
conflictname=$PROJECT_NAME
|
||||||
|
else
|
||||||
|
dpkgname=$PROJECT_NAME
|
||||||
|
conflictname=$PROJECT_NAME-musl
|
||||||
|
fi
|
||||||
|
|
||||||
|
tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
||||||
|
|
||||||
|
# copy the main binary
|
||||||
|
install -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME"
|
||||||
|
strip "$tempdir/usr/bin/$PROJECT_NAME"
|
||||||
|
|
||||||
|
# manpage
|
||||||
|
install -Dm644 "doc/$PROJECT_NAME.1" "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"
|
||||||
|
gzip --best "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"
|
||||||
|
|
||||||
|
# readme and license
|
||||||
|
install -Dm644 README.md "$tempdir/usr/share/doc/$PROJECT_NAME/README.md"
|
||||||
|
install -Dm644 LICENSE-MIT "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-MIT"
|
||||||
|
install -Dm644 LICENSE-APACHE "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-APACHE"
|
||||||
|
|
||||||
|
# completions
|
||||||
|
install -Dm644 target/$TARGET/release/build/$PROJECT_NAME-*/out/$PROJECT_NAME.bash "$tempdir/usr/share/bash-completion/completions/${PROJECT_NAME}"
|
||||||
|
install -Dm644 target/$TARGET/release/build/$PROJECT_NAME-*/out/$PROJECT_NAME.fish "$tempdir/usr/share/fish/completions/$PROJECT_NAME.fish"
|
||||||
|
install -Dm644 target/$TARGET/release/build/$PROJECT_NAME-*/out/_$PROJECT_NAME "$tempdir/usr/share/zsh/vendor-completions/_$PROJECT_NAME"
|
||||||
|
|
||||||
|
# Control file
|
||||||
|
mkdir "$tempdir/DEBIAN"
|
||||||
|
cat > "$tempdir/DEBIAN/control" <<EOF
|
||||||
|
Package: $dpkgname
|
||||||
|
Version: $version
|
||||||
|
Section: utils
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: David Peter <mail@david-peter.de>
|
||||||
|
Architecture: $architecture
|
||||||
|
Provides: $PROJECT_NAME
|
||||||
|
Conflicts: $conflictname
|
||||||
|
Description: Simple, fast and user-friendly alternative to find
|
||||||
|
While fd does not seek to mirror all of find's powerful functionality, it
|
||||||
|
provides sensible (opinionated) defaults for 80% of the use cases.
|
||||||
|
EOF
|
||||||
|
|
||||||
|
fakeroot dpkg-deb --build "$tempdir" "${dpkgname}_${version}_${architecture}.deb"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
main() {
|
||||||
|
build
|
||||||
|
pack
|
||||||
|
if [[ $TARGET = *linux* ]]; then
|
||||||
|
make_deb
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
33
src/app.rs
Normal file
33
src/app.rs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
use clap::{App, Arg};
|
||||||
|
|
||||||
|
pub fn build_app() -> App<'static, 'static> {
|
||||||
|
App::new("lsd")
|
||||||
|
.version(crate_version!())
|
||||||
|
.about("An ls comment with a lot of pretty colors and some other stuff.")
|
||||||
|
.arg(Arg::with_name("FILE").multiple(true).default_value("."))
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("all")
|
||||||
|
.short("a")
|
||||||
|
.long("all")
|
||||||
|
.help("Do not ignore entries starting with ."),
|
||||||
|
).arg(
|
||||||
|
Arg::with_name("long")
|
||||||
|
.short("l")
|
||||||
|
.long("long")
|
||||||
|
.help("Display extended file metadata as a table"),
|
||||||
|
).arg(
|
||||||
|
Arg::with_name("oneline")
|
||||||
|
.short("1")
|
||||||
|
.long("oneline")
|
||||||
|
.help("Display one entry per line"),
|
||||||
|
).arg(
|
||||||
|
Arg::with_name("recursive")
|
||||||
|
.short("R")
|
||||||
|
.long("recursive")
|
||||||
|
.help("Recurse into directories"),
|
||||||
|
).arg(
|
||||||
|
Arg::with_name("tree")
|
||||||
|
.long("tree")
|
||||||
|
.help("Recurse into directories and present the result as a tree"),
|
||||||
|
)
|
||||||
|
}
|
32
src/main.rs
32
src/main.rs
|
@ -1,3 +1,4 @@
|
||||||
|
#[macro_use]
|
||||||
extern crate clap;
|
extern crate clap;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
|
@ -8,6 +9,7 @@ extern crate terminal_size;
|
||||||
extern crate time;
|
extern crate time;
|
||||||
extern crate users;
|
extern crate users;
|
||||||
|
|
||||||
|
mod app;
|
||||||
mod batch;
|
mod batch;
|
||||||
mod color;
|
mod color;
|
||||||
mod core;
|
mod core;
|
||||||
|
@ -15,7 +17,6 @@ mod display;
|
||||||
mod icon;
|
mod icon;
|
||||||
mod meta;
|
mod meta;
|
||||||
|
|
||||||
use clap::{App, Arg};
|
|
||||||
use core::Core;
|
use core::Core;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
@ -29,34 +30,7 @@ pub struct Options {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let matches = App::new("lsd")
|
let matches = app::build_app().get_matches();
|
||||||
.about("An ls comment with a lot of pretty colors and some other stuff.")
|
|
||||||
.arg(Arg::with_name("FILE").multiple(true).default_value("."))
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("all")
|
|
||||||
.short("a")
|
|
||||||
.long("all")
|
|
||||||
.help("Do not ignore entries starting with ."),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("long")
|
|
||||||
.short("l")
|
|
||||||
.long("long")
|
|
||||||
.help("Display extended file metadata as a table"),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("oneline")
|
|
||||||
.short("1")
|
|
||||||
.long("oneline")
|
|
||||||
.help("Display one entry per line"),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("recursive")
|
|
||||||
.short("R")
|
|
||||||
.long("recursive")
|
|
||||||
.help("Recurse into directories"),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("tree")
|
|
||||||
.long("tree")
|
|
||||||
.help("Recurse into directories and present the result as a tree"),
|
|
||||||
).get_matches();
|
|
||||||
|
|
||||||
let options = Options {
|
let options = Options {
|
||||||
display_all: matches.is_present("all"),
|
display_all: matches.is_present("all"),
|
||||||
|
|
|
@ -12,20 +12,20 @@ pub enum Unit {
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub struct Size {
|
pub struct Size {
|
||||||
value: usize,
|
value: i64,
|
||||||
unit: Unit,
|
unit: Unit,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a Metadata> for Size {
|
impl<'a> From<&'a Metadata> for Size {
|
||||||
fn from(meta: &Metadata) -> Self {
|
fn from(meta: &Metadata) -> Self {
|
||||||
let len = meta.len() as usize;
|
let len = meta.len();
|
||||||
|
|
||||||
Size::from_bytes(len)
|
Size::from_bytes(len as i64)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Size {
|
impl Size {
|
||||||
fn from_bytes(len: usize) -> Self {
|
fn from_bytes(len: i64) -> Self {
|
||||||
if len < 1024 {
|
if len < 1024 {
|
||||||
Size {
|
Size {
|
||||||
value: len * 1024,
|
value: len * 1024,
|
||||||
|
|
Loading…
Reference in a new issue