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

Issue with rendering on a command suggested in the Readme #2500

Closed
AlexCzar opened this issue Mar 13, 2023 · 5 comments
Closed

Issue with rendering on a command suggested in the Readme #2500

AlexCzar opened this issue Mar 13, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@AlexCzar
Copy link

This might be related or even the same as #2185, but what's a bit awkward is that this manifests in the setup which is recommended in the readme.

What steps will reproduce the bug?

  1. Readme suggests adding a help function, for making generic --help viewing nice. Run the suggested command: git commit --help | bat --plain --language=help

What happens?
image

What did you expect to happen instead?

Nicely rendered help without escape sequences

How did you install bat?

homebrew


bat version and environment

Software version

bat 0.22.1

Operating system

macOS 13.2.1 (Darwin 22.3.0)

Command-line

bat --plain -l help --diagnostic 

Environment variables

SHELL=/bin/zsh
PAGER=less
LESS=-R
LANG=en_US.UTF-8
LC_ALL=<not set>
BAT_PAGER=<not set>
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS=<not set>
BAT_STYLE=<not set>
BAT_TABS=<not set>
BAT_THEME=<not set>
XDG_CONFIG_HOME=<not set>
XDG_CACHE_HOME=<not set>
COLORTERM=truecolor
NO_COLOR=<not set>
MANPAGER=<not set>

System Config file

Could not read contents of '/etc/bat/config': No such file or directory (os error 2).

Config file

Could not read contents of '/Users/username/.config/bat/config': No such file or directory (os error 2).

Custom assets metadata

Could not read contents of '/Users/username/.cache/bat/metadata.yaml': No such file or directory (os error 2).

Custom assets

'/Users/username/.cache/bat' not found

Compile time information

  • Profile: release
  • Target triple: aarch64-apple-darwin
  • Family: unix
  • OS: macos
  • Architecture: aarch64
  • Pointer width: 64
  • Endian: little
  • CPU features: aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,vh
  • Host: aarch64-apple-darwin

Less version

> less --version 
less 581.2 (POSIX regular expressions)
Copyright (C) 1984-2021  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less
@AlexCzar AlexCzar added the bug Something isn't working label Mar 13, 2023
@LowLevelLover
Copy link

I test it with bat v0.23.0 and v0.22.1, but everything works well for me. I am on Linux 6.1.15-200.fc37.x86_64 with less 590, other details are the same as you.

@AlexCzar
Copy link
Author

AlexCzar commented Apr 26, 2023

I think the issue is MacOS specific. And it also happens in man pages, not only git help.
man ssh-keyscan | bat -pl man results in:
image

@eclairevoyant
Copy link

@AlexCzar try piping through col -bx first before piping through bat, e.g.,

git commit --help | col -bx | bat -pl help

the -b option is what will trim out the backspaces (the ^H characters) and is specifically suggested in the README

@eclairevoyant
Copy link

also, duplicate of #2204

@AlexCzar
Copy link
Author

Thanks, missed it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants