bat mishighlights Users that start with digits in SSH config

Created on 12 May 2020  ·  13Comments  ·  Source: sharkdp/bat

Related: https://github.com/sharkdp/bat/pull/582

What version of bat are you using?
bat 0.15.1

Describe the bug you encountered:
My User for my SSH Hosts start with a numeric character. bat shows the digits in a different color than the alpha characters:
Screen Shot 2020-05-11 at 22 38 57

Describe what you expected to happen?
The entire User should be colored as tan, not just the sratna. Note that GitHub also misrenders the User: https://github.com/sumanthratna/dotprophet/blob/50781d97425d37b35a3cfbfb4e72abdb7873325d/sshconfig.

How did you install bat?
Homebrew


system

$ uname -srm
Darwin 19.5.0 x86_64

$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.5
BuildVersion: 19F72f

bat

$ bat --version
bat 0.15.1

$ env

bat_config

bat_wrapper

No wrapper script for 'bat'.

bat_wrapper_function

No wrapper function for 'bat'.

No wrapper function for 'cat'.

tool

$ less --version
less 487 (POSIX regular expressions)

bug syntax-highlighting upstream-error

Most helpful comment

The sysadmin in me wants to clean up your ssh_config.

Host tj
    HostName jumpbox.example.com
    User you

Host zoidberg director snowy
    User you
    ProxyJump tj

Host *
    # The things from the top of your file, except
    # most of them are already defaults.
    ServerAliveInterval 120

or even

Host tj
    HostName jumpbox.example.com

Host zoidberg director snowy
    ProxyJump tj

Host *.example.com
    User you

Host *
    # The things from the top of your file, except
    # most of them are already defaults.
    ServerAliveInterval 120

All 13 comments

Thank you for reporting this.

This needs to be fixed upstream in https://github.com/robballou/sublimetext-sshconfig

It looks like this got fixed: https://github.com/robballou/sublimetext-sshconfig/issues/7#event-3329426974. I'll close this issue once the next release of bat is published.

The sysadmin in me wants to clean up your ssh_config.

Host tj
    HostName jumpbox.example.com
    User you

Host zoidberg director snowy
    User you
    ProxyJump tj

Host *
    # The things from the top of your file, except
    # most of them are already defaults.
    ServerAliveInterval 120

or even

Host tj
    HostName jumpbox.example.com

Host zoidberg director snowy
    ProxyJump tj

Host *.example.com
    User you

Host *
    # The things from the top of your file, except
    # most of them are already defaults.
    ServerAliveInterval 120

It looks like this got fixed: robballou/sublimetext-sshconfig#7 (comment).

:+1:

I'm closing the ticket now, but feel free to re-open this, if this should still be an issue in the next release

I just tried bat ~/.ssh/config and bat isn't showing any syntax highlighting. Should I create a new issue for this or does this sound like an issue with https://github.com/robballou/sublimetext-sshconfig?

EDIT: I installed from brew; I'm on bat 0.15.1.

I just tried bat ~/.ssh/config and bat isn't showing any syntax highlighting. Should I create a new issue for this or does this sound like an issue with https://github.com/robballou/sublimetext-sshconfig?

EDIT: I installed from brew; I'm on bat 0.15.1.

That should work and sounds like some kind of bug. It would be great if you could open a new ticket. (I can not reproduce it with 0.15.1)

This issue should be fixed in bat v0.15.2. Feedback would be appreciated.

I don't think this has been fixed for me. The output looks the same as that in the screenshot in the original post.

I don't think it's an upstream problem anymore. There's a unit test for your username. It passes. 🤷‍♂️

This is strange; the submodule for sublimetext-sshconfig in this repo (sharkdp/bat) has been updated: https://github.com/sharkdp/bat/commit/257f978cebab7942b813cc3bd5ad74a833d35b97.

Oh, this is my fault. I forgot to rebuild the binary caches. I will put out a new release soon.

Should be fixed in v0.15.3.

It works in v0.15.3!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomgoren picture tomgoren  ·  3Comments

yum-feng picture yum-feng  ·  3Comments

HakubJozak picture HakubJozak  ·  3Comments

jkaan picture jkaan  ·  3Comments

x70b1 picture x70b1  ·  3Comments