Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
editors
code-minimap
code-minimap-0.6.4.obscpio
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File code-minimap-0.6.4.obscpio of Package code-minimap
07070100000000000081A400000000000000000000000161D067AB00000025000000000000000000000000000000000000002200000000code-minimap-0.6.4/.gitattributes/completions/**/* linguist-generated 07070100000001000041ED00000000000000000000000261D067AB00000000000000000000000000000000000000000000001B00000000code-minimap-0.6.4/.github07070100000002000081A400000000000000000000000161D067AB000000ED000000000000000000000000000000000000002A00000000code-minimap-0.6.4/.github/dependabot.ymlversion: 2 updates: - package-ecosystem: cargo directory: "/" schedule: interval: weekly reviewers: - wfxr labels: - dependencies commit-message: prefix: "chore" prefix-development: "chore" include: "scope" 07070100000003000041ED00000000000000000000000261D067AB00000000000000000000000000000000000000000000002500000000code-minimap-0.6.4/.github/workflows07070100000004000081A400000000000000000000000161D067AB0000364A000000000000000000000000000000000000002E00000000code-minimap-0.6.4/.github/workflows/CICD.ymlname: CICD env: PROJECT_NAME: code-minimap PROJECT_DESC: "A high performance code minimap generator" PROJECT_MAINTAINER: "Wenxuan Zhang <wenxuangm@gmail.com>" PROJECT_HOMEPAGE: "https://github.com/wfxr/code-minimap" on: [push, pull_request] jobs: build: name: Build runs-on: ${{ matrix.job.os }} strategy: fail-fast: false matrix: job: - { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf , use-cross: use-cross } - { os: ubuntu-latest , target: aarch64-unknown-linux-gnu , use-cross: use-cross } - { os: ubuntu-latest , target: i686-unknown-linux-gnu , use-cross: use-cross } - { os: ubuntu-latest , target: i686-unknown-linux-musl , use-cross: use-cross } - { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , use-cross: use-cross } - { os: ubuntu-latest , target: x86_64-unknown-linux-musl , use-cross: use-cross } - { os: macos-latest , target: x86_64-apple-darwin } # - { os: windows-latest , target: i686-pc-windows-msvc } - { os: windows-latest , target: x86_64-pc-windows-msvc } steps: - name: Git checkout uses: actions/checkout@v1 - name: Install prerequisites shell: bash run: | case ${{ matrix.job.target }} in arm-unknown-linux-gnueabihf) sudo apt-get -y update; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; aarch64-unknown-linux-gnu) sudo apt-get -y update; sudo apt-get -y install gcc-aarch64-linux-gnu ;; esac - name: Initialize workflow variables id: vars shell: bash run: | # staging directory STAGING='_staging' echo set-output name=STAGING::${STAGING} echo ::set-output name=STAGING::${STAGING} # determine EXE suffix EXE_suffix="" ; case ${{ matrix.job.target }} in *-pc-windows-*) EXE_suffix=".exe" ;; esac; echo set-output name=EXE_suffix::${EXE_suffix} echo ::set-output name=EXE_suffix::${EXE_suffix} # parse commit reference info REF_NAME=${GITHUB_REF#refs/*/} unset REF_BRANCH ; case ${GITHUB_REF} in refs/heads/*) REF_BRANCH=${GITHUB_REF#refs/heads/} ;; esac; unset REF_TAG ; case ${GITHUB_REF} in refs/tags/*) REF_TAG=${GITHUB_REF#refs/tags/} ;; esac; REF_SHAS=${GITHUB_SHA:0:8} echo set-output name=REF_NAME::${REF_NAME} echo set-output name=REF_BRANCH::${REF_BRANCH} echo set-output name=REF_TAG::${REF_TAG} echo set-output name=REF_SHAS::${REF_SHAS} echo ::set-output name=REF_NAME::${REF_NAME} echo ::set-output name=REF_BRANCH::${REF_BRANCH} echo ::set-output name=REF_TAG::${REF_TAG} echo ::set-output name=REF_SHAS::${REF_SHAS} # parse target unset TARGET_ARCH ; case ${{ matrix.job.target }} in arm-unknown-linux-gnueabihf) TARGET_ARCH=arm ;; i686-*) TARGET_ARCH=i686 ;; x86_64-*) TARGET_ARCH=x86_64 ;; esac; echo set-output name=TARGET_ARCH::${TARGET_ARCH} echo ::set-output name=TARGET_ARCH::${TARGET_ARCH} unset TARGET_OS ; case ${{ matrix.job.target }} in *-linux-*) TARGET_OS=linux ;; *-apple-*) TARGET_OS=macos ;; *-windows-*) TARGET_OS=windows ;; esac; echo set-output name=TARGET_OS::${TARGET_OS} echo ::set-output name=TARGET_OS::${TARGET_OS} # package name PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac; PKG_BASENAME=${PROJECT_NAME}-${REF_TAG:-$REF_SHAS}-${{ matrix.job.target }} PKG_NAME=${PKG_BASENAME}${PKG_suffix} echo set-output name=PKG_suffix::${PKG_suffix} echo set-output name=PKG_BASENAME::${PKG_BASENAME} echo set-output name=PKG_NAME::${PKG_NAME} echo ::set-output name=PKG_suffix::${PKG_suffix} echo ::set-output name=PKG_BASENAME::${PKG_BASENAME} echo ::set-output name=PKG_NAME::${PKG_NAME} # deployable tag? (ie, leading "vM" or "M"; M == version number) unset DEPLOY ; if [[ $REF_TAG =~ ^[vV]?[0-9].* ]]; then DEPLOY='true' ; fi echo set-output name=DEPLOY::${DEPLOY:-<empty>/false} echo ::set-output name=DEPLOY::${DEPLOY} # DPKG architecture? unset DPKG_ARCH case ${{ matrix.job.target }} in aarch64-*-linux-*) DPKG_ARCH=arm64 ;; arm-*-linux-*hf) DPKG_ARCH=armhf ;; i686-*-linux-*) DPKG_ARCH=i686 ;; x86_64-*-linux-*) DPKG_ARCH=amd64 ;; esac; echo set-output name=DPKG_ARCH::${DPKG_ARCH} echo ::set-output name=DPKG_ARCH::${DPKG_ARCH} # DPKG version? unset DPKG_VERSION ; if [[ $REF_TAG =~ ^[vV]?[0-9].* ]]; then DPKG_VERSION=${REF_TAG/#[vV]/} ; fi echo set-output name=DPKG_VERSION::${DPKG_VERSION} echo ::set-output name=DPKG_VERSION::${DPKG_VERSION} # DPKG base name/conflicts? DPKG_BASENAME=${PROJECT_NAME} DPKG_CONFLICTS=${PROJECT_NAME}-musl case ${{ matrix.job.target }} in *-musl) DPKG_BASENAME=${PROJECT_NAME}-musl ; DPKG_CONFLICTS=${PROJECT_NAME} ;; esac; echo set-output name=DPKG_BASENAME::${DPKG_BASENAME} echo set-output name=DPKG_CONFLICTS::${DPKG_CONFLICTS} echo ::set-output name=DPKG_BASENAME::${DPKG_BASENAME} echo ::set-output name=DPKG_CONFLICTS::${DPKG_CONFLICTS} # DPKG name unset DPKG_NAME; if [[ -n $DPKG_ARCH && -n $DPKG_VERSION ]]; then DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb" ; fi echo set-output name=DPKG_NAME::${DPKG_NAME} echo ::set-output name=DPKG_NAME::${DPKG_NAME} # target-specific options # * CARGO_USE_CROSS (truthy) CARGO_USE_CROSS='true' ; case '${{ matrix.job.use-cross }}' in ''|0|f|false|n|no) unset CARGO_USE_CROSS ;; esac; echo set-output name=CARGO_USE_CROSS::${CARGO_USE_CROSS:-<empty>/false} echo ::set-output name=CARGO_USE_CROSS::${CARGO_USE_CROSS} # # * `arm` cannot be tested on ubuntu-* hosts (b/c testing is currently primarily done via comparison of target outputs with built-in outputs and the `arm` target is not executable on the host) JOB_DO_TESTING="true" case ${{ matrix.job.target }} in arm-*) unset JOB_DO_TESTING ;; esac; echo set-output name=JOB_DO_TESTING::${JOB_DO_TESTING:-<empty>/false} echo ::set-output name=JOB_DO_TESTING::${JOB_DO_TESTING} # # * test only library unit tests and binary for arm-type targets unset CARGO_TEST_OPTIONS # unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}" ;; esac; echo set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS} echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS} # * executable for `strip`? STRIP="strip" ; case ${{ matrix.job.target }} in arm-unknown-linux-gnueabihf) STRIP="arm-linux-gnueabihf-strip" ;; aarch64-unknown-linux-gnu) STRIP="aarch64-linux-gnu-strip" ;; *-pc-windows-msvc) STRIP="" ;; esac; echo set-output name=STRIP::${STRIP} echo ::set-output name=STRIP::${STRIP} - name: Create all needed build/work directories shell: bash run: | mkdir -p '${{ steps.vars.outputs.STAGING }}' mkdir -p '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}' mkdir -p '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/completions' mkdir -p '${{ steps.vars.outputs.STAGING }}/dpkg' - name: Info shell: bash run: | gcc --version || true rustup -V rustup toolchain list rustup default cargo -V rustc -V - name: Build uses: actions-rs/cargo@v1 with: use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }} command: build args: --release --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} - name: Test uses: actions-rs/cargo@v1 with: use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }} command: test args: --target=${{ matrix.job.target }} ${{ steps.vars.outputs.CARGO_TEST_OPTIONS}} ${{ matrix.job.cargo-options }} - name: Test run uses: actions-rs/cargo@v1 with: use-cross: ${{ steps.vars.outputs.CARGO_USE_CROSS }} command: run args: Cargo.toml - name: Strip binary shell: bash run: | if [ -n "${{ steps.vars.outputs.STRIP }}" ]; then ${{ steps.vars.outputs.STRIP }} 'target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}' fi - name: Upload build artifacts uses: actions/upload-artifact@master with: name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }} path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }} - name: Package shell: bash run: | ARCHIVE_DIR='${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/' COPYRIGHT_YEARS="2020 - "$(date "+%Y") BINARY_NAME='${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}' BINARY_PATH='target/${{ matrix.job.target }}/release/'"$BINARY_NAME" # Copy binary cp "$BINARY_PATH" "$ARCHIVE_DIR" # README, LICENSE and CHANGELOG files cp README.md LICENSE* "$ARCHIVE_DIR" # Autocompletion files cp -r 'completions' "$ARCHIVE_DIR/" # base compressed package pushd '${{ steps.vars.outputs.STAGING }}/' >/dev/null case ${{ matrix.job.target }} in *-pc-windows-*) 7z -y a '${{ steps.vars.outputs.PKG_NAME }}' '${{ steps.vars.outputs.PKG_BASENAME }}'/* | tail -2 ;; *) tar zcvf '${{ steps.vars.outputs.PKG_NAME }}' '${{ steps.vars.outputs.PKG_BASENAME }}'/* ;; esac; popd >/dev/null # Debian package if [ -n "${{ steps.vars.outputs.DPKG_NAME }}" ]; then DPKG_DIR="${{ steps.vars.outputs.STAGING }}/dpkg" # Binary install -Dm755 "$BINARY_PATH" "${DPKG_DIR}/usr/bin/$BINARY_NAME" # Autocompletion files dir="${DPKG_DIR}/usr/share/fish/vendor_completions.d/" && mkdir -p "$dir" install -Dm644 completions/fish/* "$dir" dir="${DPKG_DIR}/usr/share/zsh/vendor-completions/" && mkdir -p "$dir" install -Dm644 completions/zsh/* "$dir" # README and LICENSE dir="${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/" && mkdir -p "$dir" install -Dm644 README.md "$dir" install -Dm644 LICENSE* "$dir" cat > "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/copyright" <<EOF Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: ${{ env.PROJECT_NAME }} Source: ${{ env.PROJECT_HOMEPAGE }} Files: * Copyright: $COPYRIGHT_YEARS ${{ env.PROJECT_MAINTAINER }} License: Apache-2.0 or MIT License: Apache-2.0 On Debian systems, the complete text of the Apache-2.0 can be found in the file /usr/share/common-licenses/Apache-2.0. License: MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: . The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. . THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. EOF chmod 644 "${DPKG_DIR}/usr/share/doc/${{ steps.vars.outputs.DPKG_BASENAME }}/copyright" # control file mkdir -p "${DPKG_DIR}/DEBIAN" cat > "${DPKG_DIR}/DEBIAN/control" <<EOF Package: ${{ steps.vars.outputs.DPKG_BASENAME }} Version: ${{ steps.vars.outputs.DPKG_VERSION }} Section: utils Priority: optional Maintainer: ${{ env.PROJECT_MAINTAINER }} Homepage: ${{ env.PROJECT_HOMEPAGE }} Architecture: ${{ steps.vars.outputs.DPKG_ARCH }} Provides: ${{ env.PROJECT_NAME }} Conflicts: ${{ steps.vars.outputs.DPKG_CONFLICTS }} Description: ${{ env.PROJECT_DESC }} EOF # build dpkg fakeroot dpkg-deb --build "${DPKG_DIR}" "${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.DPKG_NAME }}" fi - name: Publish archives and packages uses: softprops/action-gh-release@v1 if: steps.vars.outputs.DEPLOY with: files: | ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }} ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.DPKG_NAME }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 07070100000005000081A400000000000000000000000161D067AB00000008000000000000000000000000000000000000001E00000000code-minimap-0.6.4/.gitignore/target 07070100000006000081A400000000000000000000000161D067AB00000414000000000000000000000000000000000000002B00000000code-minimap-0.6.4/.pre-commit-config.yaml# See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.0.1 hooks: - id: trailing-whitespace - id: check-yaml - id: check-added-large-files - id: mixed-line-ending - id: check-toml - repo: local hooks: - id: cargo-fmt name: cargo fmt pass_filenames: false always_run: true language: system entry: cargo fmt - id: cargo-check name: cargo check pass_filenames: false always_run: true language: system entry: cargo check - id: cargo-clippy name: cargo clippy pass_filenames: false language: system always_run: true entry: cargo clippy args: ["--", "-D", "warnings"] - id: update-completions name: update shell completions pass_filenames: false language: system always_run: true entry: > sh -c ' touch build.rs && SHELL_COMPLETIONS_DIR=completions cargo build && git add completions ' 07070100000007000081A400000000000000000000000161D067AB00000131000000000000000000000000000000000000002100000000code-minimap-0.6.4/.rustfmt.tomledition = "2021" struct_field_align_threshold = 40 max_width = 120 comment_width = 120 reorder_imports = true fn_single_line = false imports_layout = "HorizontalVertical" match_arm_blocks = false overflow_delimited_expr = true imports_granularity = "Crate" struct_lit_width = 60 struct_variant_width = 60 07070100000008000081A400000000000000000000000161D067AB0000242E000000000000000000000000000000000000001E00000000code-minimap-0.6.4/Cargo.lock# This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "anyhow" version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84450d0b4a8bd1ba4144ce8ce718fbc5d071358b1e5384bace6536b3d1f2d5b3" [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", "winapi", ] [[package]] name = "autocfg" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d17bf219fcd37199b9a29e00ba65dfb8cd5b2688b7297ec14ff829c40ac50ca9" dependencies = [ "atty", "bitflags", "clap_derive", "indexmap", "lazy_static", "os_str_bytes", "strsim", "termcolor", "terminal_size", "textwrap", ] [[package]] name = "clap_complete" version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60d123fbea4c5d9799cffd44051e2125c880efd23b3b7c529baf3ea5508c8736" dependencies = [ "clap", ] [[package]] name = "clap_derive" version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1b9752c030a14235a0bd5ef3ad60a1dcac8468c30921327fc8af36b20c790b9" dependencies = [ "heck", "proc-macro-error", "proc-macro2", "quote", "syn", ] [[package]] name = "code-minimap" version = "0.6.4" dependencies = [ "anyhow", "clap", "clap_complete", "itertools", "rstest", "strum", ] [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "hashbrown" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "heck" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" dependencies = [ "unicode-segmentation", ] [[package]] name = "hermit-abi" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ "libc", ] [[package]] name = "indexmap" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ "autocfg", "hashbrown", ] [[package]] name = "itertools" version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" dependencies = [ "either", ] [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a" [[package]] name = "memchr" version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "os_str_bytes" version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" dependencies = [ "memchr", ] [[package]] name = "proc-macro-error" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", "syn", "version_check", ] [[package]] name = "proc-macro-error-attr" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ "proc-macro2", "quote", "version_check", ] [[package]] name = "proc-macro2" version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612" dependencies = [ "unicode-xid", ] [[package]] name = "quote" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ "proc-macro2", ] [[package]] name = "rstest" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d912f35156a3f99a66ee3e11ac2e0b3f34ac85a07e05263d05a7e2c8810d616f" dependencies = [ "cfg-if", "proc-macro2", "quote", "rustc_version", "syn", ] [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ "semver", ] [[package]] name = "rustversion" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" [[package]] name = "semver" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012" [[package]] name = "strsim" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "strum" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bb0dc7ee9c15cea6199cde9a127fa16a4c5819af85395457ad72d68edc85a38" dependencies = [ "heck", "proc-macro2", "quote", "rustversion", "syn", ] [[package]] name = "syn" version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d010a1623fbd906d51d650a9916aaefc05ffa0e4053ff7fe601167f3e715d194" dependencies = [ "proc-macro2", "quote", "unicode-xid", ] [[package]] name = "termcolor" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" dependencies = [ "winapi-util", ] [[package]] name = "terminal_size" version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" dependencies = [ "libc", "winapi", ] [[package]] name = "textwrap" version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80" dependencies = [ "terminal_size", ] [[package]] name = "unicode-segmentation" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" [[package]] name = "unicode-xid" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "version_check" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ "winapi", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 07070100000009000081A400000000000000000000000161D067AB00000523000000000000000000000000000000000000001E00000000code-minimap-0.6.4/Cargo.toml[package] name = "code-minimap" version = "0.6.4" authors = ["Wenxuan Zhang <wenxuangm@gmail.com>"] description="A high performance code minimap generator" categories = ["command-line-utilities"] homepage = "https://github.com/wfxr/code-minimap" keywords = [ "minimap", "tool", ] license = "MIT/Apache-2.0" exclude = ["/completions"] repository = "https://github.com/wfxr/code-minimap" edition = "2021" build = "build.rs" [features] default = ["application"] # Feature required for build the `code-minimap` application. Should be disabled when # depending on `code-minimap` as a library. application = ["clap", "clap_complete", "strum"] [lib] name = "code_minimap" path = "src/lib.rs" [[bin]] name = "code-minimap" path = "src/bin/code-minimap/main.rs" [dependencies] anyhow = "1" itertools = "0" clap = { version = "3", features = ["wrap_help", "derive"], optional = true } clap_complete = { version = "3", optional = true } strum = { version = "0.23", features = ["derive"], optional = true } [build-dependencies] clap = { version = "3", features = ["wrap_help", "derive"], optional = true } clap_complete = { version = "3", optional = true } strum = { version = "0.23", features = ["derive"], optional = true } [dev-dependencies] rstest = "^0.12.0" [profile.release] lto = true codegen-units = 1 0707010000000A000081A400000000000000000000000161D067AB00002C5D000000000000000000000000000000000000002200000000code-minimap-0.6.4/LICENSE-APACHE Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] 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. 0707010000000B000081A400000000000000000000000161D067AB0000044B000000000000000000000000000000000000001F00000000code-minimap-0.6.4/LICENSE-MITCopyright (c) 2020-2020 Wenxuan Zhang (https://wfxr.mit-license.org/2020). Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 0707010000000C000081A400000000000000000000000161D067AB00001491000000000000000000000000000000000000001D00000000code-minimap-0.6.4/README.md<h1 align="center">🛰 code-minimap</h1> <p align="center"> <em>A high performance code minimap render.</em> </p> <p align="center"> <a href="https://github.com/wfxr/code-minimap/actions?query=workflow%3ACICD"> <img src="https://github.com/wfxr/code-minimap/workflows/CICD/badge.svg" alt="CICD"/> </a> <img src="https://img.shields.io/crates/l/code-minimap.svg" alt="License"/> <a href="https://crates.io/crates/code-minimap"> <img src="https://img.shields.io/crates/v/code-minimap.svg?colorB=319e8c" alt="Version"> </a> <a href="https://github.com/wfxr/code-minimap/releases"> <img src="https://img.shields.io/badge/platform-%20Linux%20|%20OSX%20|%20Win%20|%20ARM-orange.svg" alt="Platform"/> </a> </p> This tool is for generating text minimaps at 🚀 speed. You can use it to implement IDE-like minimap plugin for a terminal text editor, [minimap.vim](https://github.com/wfxr/minimap.vim) for example. ### Features * Small and *fast* (see [benchmarks](#benchmark) below). * Little constant memory usage. * Freely zoom. * [Multi platforms](https://github.com/wfxr/code-minimap/releases) support. ### Usage ``` $ code-minimap src/core.rs -H 0.6 -V 0.5 ⣿⣿⣿⣿⣿⠿⠛⠓⠒⠒⠂ ⣉⣿⣿⣿⣟⣛⣛⣛⠒⠒⠂ ⠀⠉⣿⣿⣿⣿⠭⠭⠭⠭⠤⠤⠤⠤⠤ ⠀⠉⠛⠻⢿⣿⣿⣿⣿⣶⣶⣶⣒⣒⣒⣒⣒⣒⣀⣀⣀⣀⣀⣀⣀⣀⣀⡀ ⠀⣀⣶⣾⣿⣿⣿⣿⣭⣭⣭⣤⣤⣤⣤⣤⠤⠤⠤⠤⠤ ⣿⣿⣿⣶⡒⠒⠒⠒ ⣿⣿⣶⣶⣶⣶⣶⣶⣤⣤⣤⣤⣤⣤⣤⣤⣄ ⣭⣭⣭⣭⠭⠭⠭⠭⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉ ⣿⣿⣿⣿⣧⣤⣤⣤⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⡀ ⣛⣿⣿⣿⣟⣛⣒⣒⠂ ⣀⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⣋⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⡀ ⠀⣤⣭⣽⣿⣷⣶⣶⣶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠒⠒⠒⠒⠒ ⠀⠶⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠛⠓⠒⠒⠒⠒⠒ ⣉⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⡛⠛⠛⠛⠛ ⠒⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⡄ ⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇ ⠄⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠃ ``` Run `code-minimap --help` to view detailed usage. ### Installation #### On Windows You can install `code-minimap` with [scoop](https://github.com/lukesampson/scoop): ``` scoop bucket add extras scoop install code-minimap ``` #### On Arch Linux `code-minimap` is available in the Arch User Repository. To install it from [AUR](https://aur.archlinux.org/packages/code-minimap): ``` yay -S code-minimap ``` #### On macOS You can install `code-minimap` with Homebrew: ``` brew install code-minimap ``` or with MacPorts: ``` sudo port install code-minimap ``` #### From binaries Prebuilt versions of `code-minimap` for various architectures are available at [Github release page](https://github.com/wfxr/code-minimap/releases). *Note that you can try the `musl` version (which is statically-linked) if runs into dependency related errors.* #### From source `code-minimap` is also published on [crates.io](https://crates.io). If you have Rust toolchains (1.40 or above) installed you can use `cargo` to install it from source: ``` cargo install --locked code-minimap ``` If you want the latest version, clone this repository and run `cargo build --release`. ### Benchmark - [src/core.rs](https://github.com/wfxr/code-minimap/blob/v0.3.0/src/core.rs): ``` $ hyperfine -w 10 'code-minimap src/core.rs' Benchmark #1: code-minimap src/core.rs Time (mean ± σ): 0.2 ms ± 0.1 ms [User: 0.4 ms, System: 0.3 ms] Range (min … max): 0.2 ms … 1.1 ms 1560 runs ``` **79** lines, **4K** size, **0.2ms**. --------------------------------- - [all rust code from rust-1.46.0](https://github.com/rust-lang/rust/archive/1.46.0.tar.gz): ``` $ fd -t f -e rs -x cat "{}" >> /tmp/all-in-one.rs $ hyperfine -w 10 'code-minimap /tmp/all-in-one.rs' Benchmark #1: code-minimap /tmp/all-in-one.rs Time (mean ± σ): 322.7 ms ± 4.5 ms [User: 298.7 ms, System: 23.8 ms] Range (min … max): 318.5 ms … 334.1 ms 10 runs ``` **1,153,225** lines, **37M** size, **323ms**. --------------------------------- - [huge random file](): ``` $ base64 /dev/urandom | head -10000000 > huge.txt $ hyperfine -w 1 'code-minimap huge.txt' Benchmark #1: code-minimap huge.txt Time (mean ± σ): 2.941 s ± 0.034 s [User: 2.618 s, System: 0.321 s] Range (min … max): 2.919 s … 3.028 s 10 runs ``` **10,000,000** lines, **735M** size, **2.9s**. --------------------------------- *Test environment:* ``` Binary version: 0.3.0 OS: Arch Linux x86_64 Kernel: 5.8.10-arch1-1 CPU: Intel i9-9900K (16) @ 5.000GHz ``` ### Related Project [minimap.vim](https://github.com/wfxr/minimap.vim): Blazing fast minimap for vim. ### License `code-minimap` is distributed under the terms of both the MIT License and the Apache License 2.0. See the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files for license details. 0707010000000D000081A400000000000000000000000161D067AB00000267000000000000000000000000000000000000001C00000000code-minimap-0.6.4/build.rsuse clap::{ArgEnum, IntoApp}; use std::{fs, path::Path}; include!("src/bin/code-minimap/cli.rs"); fn main() -> Result<(), Box<dyn std::error::Error>> { let outdir = std::env::var_os("SHELL_COMPLETIONS_DIR") .or_else(|| std::env::var_os("OUT_DIR")) .expect("OUT_DIR not found"); let outdir_path = Path::new(&outdir); let app = &mut App::into_app(); for shell in Shell::value_variants() { let dir = outdir_path.join(shell.to_string()); fs::create_dir_all(&dir)?; clap_complete::generate_to(*shell, app, app.get_name().to_string(), &dir)?; } Ok(()) } 0707010000000E000041ED00000000000000000000000261D067AB00000000000000000000000000000000000000000000001F00000000code-minimap-0.6.4/completions0707010000000F000041ED00000000000000000000000261D067AB00000000000000000000000000000000000000000000002400000000code-minimap-0.6.4/completions/bash07070100000010000081A400000000000000000000000161D067AB00000B49000000000000000000000000000000000000003600000000code-minimap-0.6.4/completions/bash/code-minimap.bash_code-minimap() { local i cur prev opts cmds COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" cmd="" opts="" for i in ${COMP_WORDS[@]} do case "${i}" in "$1") cmd="code__minimap" ;; completion) cmd+="__completion" ;; help) cmd+="__help" ;; *) ;; esac done case "${cmd}" in code__minimap) opts="-h -H -V --help --version --horizontal-scale --vertical-scale --padding --encoding <FILE> completion help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in --horizontal-scale) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -H) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --vertical-scale) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; -V) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --padding) COMPREPLY=($(compgen -f "${cur}")) return 0 ;; --encoding) COMPREPLY=($(compgen -W "UTF8Lossy UTF8" -- "${cur}")) return 0 ;; *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; code__minimap__completion) opts="-h --help bash elvish fish powershell zsh" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; code__minimap__help) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 fi case "${prev}" in *) COMPREPLY=() ;; esac COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; esac } complete -F _code-minimap -o bashdefault -o default code-minimap 07070100000011000041ED00000000000000000000000261D067AB00000000000000000000000000000000000000000000002600000000code-minimap-0.6.4/completions/elvish07070100000012000081A400000000000000000000000161D067AB00000559000000000000000000000000000000000000003700000000code-minimap-0.6.4/completions/elvish/code-minimap.elv use builtin; use str; set edit:completion:arg-completer[code-minimap] = [@words]{ fn spaces [n]{ builtin:repeat $n ' ' | str:join '' } fn cand [text desc]{ edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc } var command = 'code-minimap' for word $words[1..-1] { if (str:has-prefix $word '-') { break } set command = $command';'$word } var completions = [ &'code-minimap'= { cand -H 'Specify horizontal scale factor' cand --horizontal-scale 'Specify horizontal scale factor' cand -V 'Specify vertical scale factor' cand --vertical-scale 'Specify vertical scale factor' cand --padding 'Specify padding width' cand --encoding 'Specify input encoding' cand -h 'Print help information' cand --help 'Print help information' cand --version 'Print version information' cand completion 'Generate shell completion file' cand help 'Print this message or the help of the given subcommand(s)' } &'code-minimap;completion'= { cand -h 'Print help information' cand --help 'Print help information' } &'code-minimap;help'= { } ] $completions[$command] } 07070100000013000041ED00000000000000000000000261D067AB00000000000000000000000000000000000000000000002400000000code-minimap-0.6.4/completions/fish07070100000014000081A400000000000000000000000161D067AB000003D1000000000000000000000000000000000000003600000000code-minimap-0.6.4/completions/fish/code-minimap.fishcomplete -c code-minimap -n "__fish_use_subcommand" -s H -l horizontal-scale -d 'Specify horizontal scale factor' -r complete -c code-minimap -n "__fish_use_subcommand" -s V -l vertical-scale -d 'Specify vertical scale factor' -r complete -c code-minimap -n "__fish_use_subcommand" -l padding -d 'Specify padding width' -r complete -c code-minimap -n "__fish_use_subcommand" -l encoding -d 'Specify input encoding' -r -f -a "{UTF8Lossy ,UTF8 }" complete -c code-minimap -n "__fish_use_subcommand" -s h -l help -d 'Print help information' complete -c code-minimap -n "__fish_use_subcommand" -l version -d 'Print version information' complete -c code-minimap -n "__fish_use_subcommand" -f -a "completion" -d 'Generate shell completion file' complete -c code-minimap -n "__fish_use_subcommand" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' complete -c code-minimap -n "__fish_seen_subcommand_from completion" -s h -l help -d 'Print help information' 07070100000015000041ED00000000000000000000000261D067AB00000000000000000000000000000000000000000000002A00000000code-minimap-0.6.4/completions/powershell07070100000016000081A400000000000000000000000161D067AB00000A9B000000000000000000000000000000000000003C00000000code-minimap-0.6.4/completions/powershell/_code-minimap.ps1 using namespace System.Management.Automation using namespace System.Management.Automation.Language Register-ArgumentCompleter -Native -CommandName 'code-minimap' -ScriptBlock { param($wordToComplete, $commandAst, $cursorPosition) $commandElements = $commandAst.CommandElements $command = @( 'code-minimap' for ($i = 1; $i -lt $commandElements.Count; $i++) { $element = $commandElements[$i] if ($element -isnot [StringConstantExpressionAst] -or $element.StringConstantType -ne [StringConstantType]::BareWord -or $element.Value.StartsWith('-')) { break } $element.Value }) -join ';' $completions = @(switch ($command) { 'code-minimap' { [CompletionResult]::new('-H', 'H', [CompletionResultType]::ParameterName, 'Specify horizontal scale factor') [CompletionResult]::new('--horizontal-scale', 'horizontal-scale', [CompletionResultType]::ParameterName, 'Specify horizontal scale factor') [CompletionResult]::new('-V', 'V', [CompletionResultType]::ParameterName, 'Specify vertical scale factor') [CompletionResult]::new('--vertical-scale', 'vertical-scale', [CompletionResultType]::ParameterName, 'Specify vertical scale factor') [CompletionResult]::new('--padding', 'padding', [CompletionResultType]::ParameterName, 'Specify padding width') [CompletionResult]::new('--encoding', 'encoding', [CompletionResultType]::ParameterName, 'Specify input encoding') [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') [CompletionResult]::new('--version', 'version', [CompletionResultType]::ParameterName, 'Print version information') [CompletionResult]::new('completion', 'completion', [CompletionResultType]::ParameterValue, 'Generate shell completion file') [CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)') break } 'code-minimap;completion' { [CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help information') [CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help information') break } 'code-minimap;help' { break } }) $completions.Where{ $_.CompletionText -like "$wordToComplete*" } | Sort-Object -Property ListItemText } 07070100000017000041ED00000000000000000000000261D067AB00000000000000000000000000000000000000000000002300000000code-minimap-0.6.4/completions/zsh07070100000018000081A400000000000000000000000161D067AB0000082D000000000000000000000000000000000000003100000000code-minimap-0.6.4/completions/zsh/_code-minimap#compdef code-minimap autoload -U is-at-least _code-minimap() { typeset -A opt_args typeset -a _arguments_options local ret=1 if is-at-least 5.2; then _arguments_options=(-s -S -C) else _arguments_options=(-s -C) fi local context curcontext="$curcontext" state line _arguments "${_arguments_options[@]}" \ '-H+[Specify horizontal scale factor]:HSCALE: ' \ '--horizontal-scale=[Specify horizontal scale factor]:HSCALE: ' \ '-V+[Specify vertical scale factor]:VSCALE: ' \ '--vertical-scale=[Specify vertical scale factor]:VSCALE: ' \ '--padding=[Specify padding width]:PADDING: ' \ '--encoding=[Specify input encoding]:ENCODING:(UTF8Lossy UTF8)' \ '-h[Print help information]' \ '--help[Print help information]' \ '--version[Print version information]' \ '::file -- File to read:' \ ":: :_code-minimap_commands" \ "*::: :->code-minimap" \ && ret=0 case $state in (code-minimap) words=($line[2] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:code-minimap-command-$line[2]:" case $line[2] in (completion) _arguments "${_arguments_options[@]}" \ '-h[Print help information]' \ '--help[Print help information]' \ ':shell -- Target shell name:(bash elvish fish powershell zsh)' \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" \ && ret=0 ;; esac ;; esac } (( $+functions[_code-minimap_commands] )) || _code-minimap_commands() { local commands; commands=( 'completion:Generate shell completion file' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'code-minimap commands' commands "$@" } (( $+functions[_code-minimap__completion_commands] )) || _code-minimap__completion_commands() { local commands; commands=() _describe -t commands 'code-minimap completion commands' commands "$@" } (( $+functions[_code-minimap__help_commands] )) || _code-minimap__help_commands() { local commands; commands=() _describe -t commands 'code-minimap help commands' commands "$@" } _code-minimap "$@"07070100000019000041ED00000000000000000000000261D067AB00000000000000000000000000000000000000000000001C00000000code-minimap-0.6.4/examples0707010000001A000081A400000000000000000000000161D067AB00000079000000000000000000000000000000000000002600000000code-minimap-0.6.4/examples/simple.rsuse std::io; fn main() { let stdin = io::stdin(); code_minimap::print(stdin.lock(), 1.0, 1.0, None).unwrap(); } 0707010000001B000081A400000000000000000000000161D067AB000000AC000000000000000000000000000000000000002F00000000code-minimap-0.6.4/examples/write_to_string.rsuse std::io; fn main() { let stdin = io::stdin(); let minimap = code_minimap::write_to_string(stdin.lock(), 1.0, 1.0, None).unwrap(); print!("{}", minimap); } 0707010000001C000041ED00000000000000000000000261D067AB00000000000000000000000000000000000000000000001700000000code-minimap-0.6.4/src0707010000001D000041ED00000000000000000000000261D067AB00000000000000000000000000000000000000000000001B00000000code-minimap-0.6.4/src/bin0707010000001E000041ED00000000000000000000000261D067AB00000000000000000000000000000000000000000000002800000000code-minimap-0.6.4/src/bin/code-minimap0707010000001F000081A400000000000000000000000161D067AB00000579000000000000000000000000000000000000002F00000000code-minimap-0.6.4/src/bin/code-minimap/cli.rsuse std::path::PathBuf; use clap::{AppSettings, Parser}; use clap_complete::Shell; use strum::{Display, EnumString, EnumVariantNames, VariantNames}; #[derive(Parser)] #[clap(about, version)] #[clap(global_setting(AppSettings::DeriveDisplayOrder))] pub struct App { /// File to read pub file: Option<PathBuf>, /// Specify horizontal scale factor #[clap(short = 'H', long = "horizontal-scale", default_value = "1.0")] pub hscale: f64, /// Specify vertical scale factor #[clap(short = 'V', long = "vertical-scale", default_value = "1.0")] pub vscale: f64, /// Specify padding width #[clap(long)] pub padding: Option<usize>, /// Specify input encoding #[clap(long, default_value = Encoding::VARIANTS[0], possible_values = Encoding::VARIANTS, ignore_case = true)] pub encoding: Encoding, /// Subcommand #[clap(subcommand)] pub subcommand: Option<Subcommand>, } #[derive(Parser)] pub enum Subcommand { /// Generate shell completion file Completion { /// Target shell name #[clap(arg_enum)] shell: Shell, }, } #[derive(Parser)] pub struct CompletionOpt { /// Target shell name #[clap(arg_enum)] pub shell: Shell, } #[derive(Display, EnumString, EnumVariantNames, PartialEq, Eq, PartialOrd, Ord, Hash)] #[strum(ascii_case_insensitive)] pub enum Encoding { UTF8Lossy, UTF8, } 07070100000020000081A400000000000000000000000161D067AB0000059B000000000000000000000000000000000000003000000000code-minimap-0.6.4/src/bin/code-minimap/main.rsmod cli; use clap::{IntoApp, Parser}; use cli::{App, Encoding, Subcommand}; use code_minimap::lossy_reader::LossyReader; use std::{ fs::File, io::{self, BufRead, BufReader, Read}, process, }; fn main() { if let Err(e) = try_main() { if let Some(ioerr) = e.root_cause().downcast_ref::<io::Error>() { if ioerr.kind() == io::ErrorKind::BrokenPipe { std::process::exit(0); } } eprintln!("{}: {}", env!("CARGO_PKG_NAME"), e); process::exit(1) } } fn try_main() -> anyhow::Result<()> { let opt: App = App::parse(); match opt.subcommand { Some(Subcommand::Completion { shell }) => { let app = &mut App::into_app(); clap_complete::generate(shell, app, app.get_name().to_string(), &mut io::stdout()) } None => { let stdin = io::stdin(); let reader = match &opt.file { Some(path) => buf_reader(&opt.encoding, File::open(path)?), None => buf_reader(&opt.encoding, stdin), }; code_minimap::print(reader, opt.hscale, opt.vscale, opt.padding)?; } } Ok(()) } fn buf_reader<R: 'static + Read>(encoding: &Encoding, reader: R) -> Box<dyn BufRead> { match encoding { Encoding::UTF8 => Box::new(BufReader::new(reader)), Encoding::UTF8Lossy => Box::new(LossyReader::new(reader)), } } 07070100000021000081A400000000000000000000000161D067AB00001619000000000000000000000000000000000000001F00000000code-minimap-0.6.4/src/core.rsuse std::{ io::{self, BufRead, Write}, ops::Range, }; use itertools::Itertools; /// Write minimap to the writer. pub fn write( mut writer: impl Write, reader: impl BufRead, hscale: f64, vscale: f64, padding: Option<usize>, ) -> io::Result<()> { let mut frame = [0..0, 0..0, 0..0, 0..0]; reader .lines() .map(|line| { line.map(|line| { let beg = line.find(|c: char| !c.is_whitespace()).unwrap_or(usize::max_value()); let end = line.rfind(|c: char| !c.is_whitespace()).unwrap_or(0); (beg, end) }) }) .enumerate() .map(|(i, line)| (scale(i, vscale), line)) .group_by(|(i, _)| *i) .into_iter() .chunks(4) .into_iter() .try_for_each(|chunk| { let mut chunk_size = 0; for (i, (_, group)) in chunk.enumerate() { let (beg, end) = group .into_iter() .try_fold((usize::max_value(), 0), |(beg, end), (_, line)| { line.map(|(b, e)| (beg.min(b), end.max(e))) })?; frame[i] = beg..(end + 1); chunk_size += 1; } frame.iter_mut().skip(chunk_size).for_each(|row| *row = 0..0); scale_frame(&mut frame, hscale); write_frame(&mut writer, &frame, padding) }) } /// Print minimap to the stdout. /// /// # Examples /// /// Basic usage: /// /// ``` /// use std::{io, io::BufReader}; /// /// let stdin = io::stdin(); /// code_minimap::print(stdin.lock(), 1.0, 1.0, None).unwrap(); /// ``` pub fn print(reader: impl BufRead, hscale: f64, vscale: f64, padding: Option<usize>) -> io::Result<()> { write(io::stdout(), reader, hscale, vscale, padding) } /// Write minimap to a string. /// /// # Examples /// /// Basic usage: /// /// ``` /// use std::{io, io::BufReader}; /// /// let stdin = io::stdin(); /// let s = /// code_minimap::write_to_string(stdin.lock(), 1.0, 1.0, None).unwrap(); /// print!("{}", s); /// ``` pub fn write_to_string(reader: impl BufRead, hscale: f64, vscale: f64, padding: Option<usize>) -> io::Result<String> { let mut buf = Vec::new(); write(&mut buf, reader, hscale, vscale, padding)?; Ok(String::from_utf8(buf).unwrap()) } fn write_frame(mut writer: impl Write, frame: &[Range<usize>], padding: Option<usize>) -> std::io::Result<()> { let idx = |pos| { frame .iter() .enumerate() .fold(0, |acc, (i, x)| if x.contains(&pos) { acc + (1 << i) } else { acc }) }; let end = frame.iter().max_by_key(|range| range.end).unwrap().end; let line: String = (0..end) .step_by(2) .map(|i| BRAILLE_MATRIX[(idx(i)) + (idx(i + 1) << 4)]) .collect(); match padding { Some(padding) => writeln!(writer, "{0:<1$}", line, padding), None => writeln!(writer, "{}", line), } } fn scale_frame(frame: &mut [Range<usize>], factor: f64) { for x in frame { *x = scale(x.start, factor)..scale(x.end, factor); } } fn scale(x: usize, factor: f64) -> usize { (x as f64 * factor) as usize } #[rustfmt::skip] const BRAILLE_MATRIX : [char; 256] = [ '⠀', '⠁', '⠂', '⠃', '⠄', '⠅', '⠆', '⠇', '⡀', '⡁', '⡂', '⡃', '⡄', '⡅', '⡆', '⡇', '⠈', '⠉', '⠊', '⠋', '⠌', '⠍', '⠎', '⠏', '⡈', '⡉', '⡊', '⡋', '⡌', '⡍', '⡎', '⡏', '⠐', '⠑', '⠒', '⠓', '⠔', '⠕', '⠖', '⠗', '⡐', '⡑', '⡒', '⡓', '⡔', '⡕', '⡖', '⡗', '⠘', '⠙', '⠚', '⠛', '⠜', '⠝', '⠞', '⠟', '⡘', '⡙', '⡚', '⡛', '⡜', '⡝', '⡞', '⡟', '⠠', '⠡', '⠢', '⠣', '⠤', '⠥', '⠦', '⠧', '⡠', '⡡', '⡢', '⡣', '⡤', '⡥', '⡦', '⡧', '⠨', '⠩', '⠪', '⠫', '⠬', '⠭', '⠮', '⠯', '⡨', '⡩', '⡪', '⡫', '⡬', '⡭', '⡮', '⡯', '⠰', '⠱', '⠲', '⠳', '⠴', '⠵', '⠶', '⠷', '⡰', '⡱', '⡲', '⡳', '⡴', '⡵', '⡶', '⡷', '⠸', '⠹', '⠺', '⠻', '⠼', '⠽', '⠾', '⠿', '⡸', '⡹', '⡺', '⡻', '⡼', '⡽', '⡾', '⡿', '⢀', '⢁', '⢂', '⢃', '⢄', '⢅', '⢆', '⢇', '⣀', '⣁', '⣂', '⣃', '⣄', '⣅', '⣆', '⣇', '⢈', '⢉', '⢊', '⢋', '⢌', '⢍', '⢎', '⢏', '⣈', '⣉', '⣊', '⣋', '⣌', '⣍', '⣎', '⣏', '⢐', '⢑', '⢒', '⢓', '⢔', '⢕', '⢖', '⢗', '⣐', '⣑', '⣒', '⣓', '⣔', '⣕', '⣖', '⣗', '⢘', '⢙', '⢚', '⢛', '⢜', '⢝', '⢞', '⢟', '⣘', '⣙', '⣚', '⣛', '⣜', '⣝', '⣞', '⣟', '⢠', '⢡', '⢢', '⢣', '⢤', '⢥', '⢦', '⢧', '⣠', '⣡', '⣢', '⣣', '⣤', '⣥', '⣦', '⣧', '⢨', '⢩', '⢪', '⢫', '⢬', '⢭', '⢮', '⢯', '⣨', '⣩', '⣪', '⣫', '⣬', '⣭', '⣮', '⣯', '⢰', '⢱', '⢲', '⢳', '⢴', '⢵', '⢶', '⢷', '⣰', '⣱', '⣲', '⣳', '⣴', '⣵', '⣶', '⣷', '⢸', '⢹', '⢺', '⢻', '⢼', '⢽', '⢾', '⢿', '⣸', '⣹', '⣺', '⣻', '⣼', '⣽', '⣾', '⣿', ]; #[cfg(test)] mod test { use rstest::*; use super::*; #[rstest( input, expected, case("", ""), case("a", "⠁"), case("aaaa\nbbbb\ncccc\ndddd", "⣿⣿"), case("aaa\n aa\n a\n a", "⠙⢇"), case(" a b c\n d efg \n h i\n jk", "⢐⡛⠿⠭") )] fn test_write_to_string(input: &'static str, expected: &str) { let actual = write_to_string(input.as_bytes(), 1.0, 1.0, None).unwrap(); assert_eq!(expected, actual.trim()); } } 07070100000022000081A400000000000000000000000161D067AB00000043000000000000000000000000000000000000001E00000000code-minimap-0.6.4/src/lib.rspub(crate) mod core; pub mod lossy_reader; pub use crate::core::*; 07070100000023000081A400000000000000000000000161D067AB00000333000000000000000000000000000000000000002700000000code-minimap-0.6.4/src/lossy_reader.rsuse std::io::{self, BufRead, BufReader, Read}; pub struct LossyReader<R> { inner: BufReader<R>, } impl<R: Read> LossyReader<R> { pub fn new(inner: R) -> Self { Self { inner: BufReader::new(inner) } } } impl<R: Read> Read for LossyReader<R> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { self.inner.read(buf) } } impl<R: Read> BufRead for LossyReader<R> { fn fill_buf(&mut self) -> io::Result<&[u8]> { self.inner.fill_buf() } fn consume(&mut self, amt: usize) { self.inner.consume(amt) } fn read_line(&mut self, buf: &mut String) -> std::io::Result<usize> { let mut bytes = Vec::new(); let len = self.read_until(b'\n', &mut bytes)?; buf.push_str(&String::from_utf8_lossy(&bytes)); Ok(len) } } 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!137 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor