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

--style=auto isn't the default despite documentation #1742

Closed
lilyball opened this issue Jul 20, 2021 · 3 comments · Fixed by #1781
Closed

--style=auto isn't the default despite documentation #1742

lilyball opened this issue Jul 20, 2021 · 3 comments · Fixed by #1781
Labels
bug Something isn't working documentation

Comments

@lilyball
Copy link

Describe the bug you encountered:

The manpage and --help output document that --style=auto is the default behavior. But this does not appear to be the case. Instead it appears that --style=full is the default.

Example:

> BAT_CONFIG_PATH= bat -f nix-homepage | cat
───────┬────────────────────────────────────────────────────────────────────────
       │ File: nix-homepage
───────┼────────────────────────────────────────────────────────────────────────
   1   │ #!/usr/bin/env bash
   2   │ 
   3   │ set -euo pipefail
…

What did you expect to happen instead?

It should have looked like

> BAT_CONFIG_PATH= bat --style=auto -f nix-homepage | cat
#!/usr/bin/env bash

set -euo pipefail
…

How did you install bat?

Nix


bat version and environment

Software version

bat 0.18.0

Operating system

Darwin 20.5.0

Command-line

/Users/lily/.nix-profile/bin/bat -f nix-homepage --diagnostic 

Environment variables

SHELL=/Users/lily/.local/share/home-manager/bin/fish
PAGER='less -R'
BAT_PAGER=<not set>
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=
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=<not set>
NO_COLOR=<not set>
MANPAGER=<not set>

Config file

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

[Note: Specifying BAT_CONFIG_PATH=/dev/null removes this diagnostic error but doesn't change the observed behavior. Maybe bat should just test if BAT_CONFIG_PATH is set to the empty string before trying to open it? This should still disable the config file of course]

Compile time information

  • Profile: release
  • Target triple: x86_64-apple-darwin
  • Family: unix
  • OS: macos
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2,sse3,ssse3
  • Host: x86_64-apple-darwin

Less version

> less --version 
less 563 (POSIX regular expressions)
Copyright (C) 1984-2020  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: http://www.greenwoodsoftware.com/less
@lilyball lilyball added the bug Something isn't working label Jul 20, 2021
@lilyball
Copy link
Author

I'm guessing right now that --style=full is the default because otherwise bat -f filename | cat wouldn't show decorations and that's the confusing. But this needs to be documented properly.

@Enselic
Copy link
Collaborator

Enselic commented Aug 4, 2021

Thanks a lot for taking the time to write a bug report.

It is correct that "full" is default: https://github.com/sharkdp/bat/blob/master/src/bin/bat/app.rs#L319

So we should update the docs.

@Enselic
Copy link
Collaborator

Enselic commented Aug 4, 2021

@lilyball Can you please check, from your perspective, if #1781 is sufficient as a fix for this issue?

I agree that it is confusing that we have two different 'auto' settings for this, but let's take that discussion in #1743

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

Successfully merging a pull request may close this issue.

2 participants