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

ANSI colors do not display correctly for cargo installed binary #1221

Open
ickk opened this issue Jan 4, 2025 · 1 comment
Open

ANSI colors do not display correctly for cargo installed binary #1221

ickk opened this issue Jan 4, 2025 · 1 comment

Comments

@ickk
Copy link

ickk commented Jan 4, 2025

master@e2922fd does display ANSI colors only when called via cargo:

cargo run -- .

however it does not correctly display ANSI colors when installed and run. (This also effects v13.0.0-alpha.7 installed via crates.io)

cargo install --path .; tokei .

instead the ANSI codes are displayed literally. See the image attached

image

v13.0.0-alpha.1 does work correctly when installed. alpha.2-alpha.7 are either broken in this way, or broken for other reasons (clap).

I'm using Windows 10 22H2, with powershell7 on conhost.

@ickk
Copy link
Author

ickk commented Jan 4, 2025

I bisected, and found this issue is introduced somewhere between 9ad137f (good), and 3e09c23 (bad). The commits inbetween are broken by issues with clap.

PS7 Z:\XAMPPRocky\tokei> git checkout 9ad137f
PS7 Z:\XAMPPRocky\tokei> cargo uninstall tokei; git reflog -1; cargo install -q --path .; tokei --version; tokei .
    Removing C:\Users\Nick\.cargo\bin\tokei.exe
9ad137f (HEAD) HEAD@{0}: checkout: moving from 3e09c2352e44e79fb7105d62e3eb5593dc7d7fca to 9ad137f
tokei 13.0.0-alpha.1 compiled with serialization support: json
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 Language              Files        Lines         Code     Comments       Blanks
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 BASH                      4           48           30           10            8
 JSON                      1         1923         1923            0            0
 Shell                     1           49           38            1           10
 TOML                      3          125          104            5           16
─────────────────────────────────────────────────────────────────────────────────
 HTML                      1           12            9            1            2
 |- JavaScript             1           15           11            4            0
 (Total)                               27           20            5            2
─────────────────────────────────────────────────────────────────────────────────
 Markdown                  5         1598            0         1279          319
 |- BASH                   1            3            3            0            0
 |- JSON                   1           46           46            0            0
 |- Rust                   1            7            4            3            0
 |- Shell                  1           16           14            0            2
 (Total)                             1670           67         1282          321
─────────────────────────────────────────────────────────────────────────────────
 Rust                     24         4543         3823          138          582
 |- Markdown              13          386            5          327           54
 (Total)                             4929         3828          465          636
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 Total                    39         8771         6010         1768          993
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PS7 Z:\XAMPPRocky\tokei> git checkout 9627a24
PS7 Z:\XAMPPRocky\tokei> cargo uninstall tokei; git reflog -1; cargo install -q --path .; tokei --version; tokei .
    Removing C:\Users\Nick\.cargo\bin\tokei.exe
9627a24 (HEAD) HEAD@{0}: checkout: moving from 9ad137f9436e9f4db468a84c7a6bcf35ea223855 to 9627a24
tokei 13.0.0-alpha.1 compiled with serialization support: json
thread 'main' panicked at C:\Users\Nick\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clap_builder-4.5.23\src\parser\matches\arg_matches.rs:185:17:
arg `files`'s `ArgAction` should be one of `SetTrue`, `SetFalse` which should provide a default
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
PS7 Z:\XAMPPRocky\tokei > git checkout ff11207
PS7 Z:\XAMPPRocky\tokei > cargo uninstall tokei; git reflog -1; cargo install -q --path .; tokei --version; tokei .
    Removing C:\Users\Nick\.cargo\bin\tokei.exe
ff11207 (HEAD, tag: v13.0.0-alpha.4) HEAD@{0}: checkout: moving from 9627a24c9c53ebb5ded0c297d9221b8d0d331c09 to ff11207
tokei 13.0.0-alpha.4 compiled with serialization support: json
thread 'main' panicked at C:\Users\Nick\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clap_builder-4.5.23\src\parser\error.rs:32:9:
Mismatch between definition and access of `input`. Could not downcast to TypeId(0xb98b1b7157a6417863eb502cd6cb5d6d), need to downcast to TypeId(0x1c077e732371f7072dc29459230a7de8)

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
PS7 Z:\XAMPPRocky\tokei> git checkout 3e09c23
PS7 Z:\XAMPPRocky\tokei> cargo uninstall tokei; git reflog -1; cargo install -q --path .; tokei --version; tokei .
    Removing C:\Users\Nick\.cargo\bin\tokei.exe
3e09c23 (HEAD) HEAD@{0}: checkout: moving from ff1120753954c460c00859157d39e72add5d271f to 3e09c23
tokei 13.0.0-alpha.4 compiled with serialization support: json
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ←[1;34mLanguage    ←[0m ←[1;34m         Files←[0m ←[1;34m       Lines←[0m ←[1;34m        Code←[0m ←[1;34m    Comments←[0m ←[1;34m      Blanks←[0m
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ←[1;35mBASH              ←[0m        4           48           30           10            8
 ←[1;35mJSON              ←[0m        1         1939         1939            0            0
 ←[1;35mShell             ←[0m        1           49           38            1           10
 ←[1;35mTOML              ←[0m        3          125          104            5           16
←[2m─────────────────────────────────────────────────────────────────────────────────←[0m
 ←[1;35mHTML              ←[0m        1           12            9            1            2
 |- ←[1;35mJavaScript     ←[0m        1           15           11            4            0
 (Total)                               27           20            5            2
←[2m─────────────────────────────────────────────────────────────────────────────────←[0m
 ←[1;35mMarkdown          ←[0m        5         1676            0         1348          328
 |- ←[1;35mBASH           ←[0m        1            3            3            0            0
 |- ←[1;35mJSON           ←[0m        1           46           46            0            0
 |- ←[1;35mRust           ←[0m        1            7            4            3            0
 |- ←[1;35mShell          ←[0m        1           16           14            0            2
 (Total)                             1748           67         1351          330
←[2m─────────────────────────────────────────────────────────────────────────────────←[0m
 ←[1;35mRust              ←[0m       24         4573         3850          138          585
 |- ←[1;35mMarkdown       ←[0m       14          394            5          335           54
 (Total)                             4967         3855          473          639
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ←[1;35mTotal             ←[0m ←[34m      39←[0m ←[34m        8903←[0m ←[34m        6053←[0m ←[34m        1845←[0m ←[34m        1005←[0m
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant