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

The options --map-syntax and --ignored-suffix cannot work together. #2093

Closed
edentsai opened this issue Feb 27, 2022 · 6 comments
Closed

The options --map-syntax and --ignored-suffix cannot work together. #2093

edentsai opened this issue Feb 27, 2022 · 6 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@edentsai
Copy link

edentsai commented Feb 27, 2022

Describe the bug you encountered:

The options --map-syntax and --ignored-suffix cannot work together.

How to reproduce it:

  1. Prepare a file foo.demo in YAML syntax:

    # file: foo.demo
    foo: "bar"
  2. Use bat --map-syntax "*.demo:YAML" foo.demo can print it with YAML syntax highlighting:

    bat foo.demo \
        --map-syntax "*.demo:YAML" 
  3. Copy foo.demo to foo.demo.example,
    and use bat --map-syntax "*.demo:YAML" --ignored-suffix ".example" foo.demo.example CANNOT print it with YAML syntax highlighting:

    cp "foo.demo"  "foo.demo.example"
    bat foo.demo.example \
        --map-syntax "*.demo:YAML" \
        --ignored-suffix ".example"
    # CANNOT print `foo.demo.example` with YAML syntax.
  4. BUT it works well If I only use --ignored-suffix ".example" with built-in syntax mapping:

    # Use built-in syntax mapping (YAML):
    cp foo.demo.example foo.yaml.example
    bat foo.yaml.example \
        --ignored-suffix ".example"

What did you expect to happen instead?

The options --map-syntax and --ignored-suffix can works togerher.

bat foo.demo.example \
    --map-syntax "*.demo:YAML" \
    --ignored-suffix ".example"
# I expect it can print `foo.demo.example` with YAML syntax.

How did you install bat?

Homebrew:

brew install --formula "bat"

bat version and environment

Software version

bat 0.20.0

Operating system

macOS 12.2 (Darwin 21.3.0)

Command-line

bat foo.demo.example --ignored-suffix .example --diagnostic 

Environment variables

SHELL=/opt/homebrew/bin/bash
PAGER=<not set>
LESS='--no-init --quit-if-one-screen --ignore-case --status-column --LONG-PROMPT --RAW-CONTROL-CHARS --HILITE-UNREAD --tabs=4 --window=-6 '
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
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=~/.config
XDG_CACHE_HOME=~/.cache
COLORTERM=truecolor
NO_COLOR=<not set>
MANPAGER='sh -c '\''col -b -x | bat --language "man" --style "plain"'\'''

Config file

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

Compile time information

  • Profile: release
  • Target triple: aarch64-apple-darwin
  • Family: unix
  • OS: macos
  • Architecture: aarch64
  • Pointer width: 64
  • Endian: little
  • CPU features: unknown
  • Host: aarch64-apple-darwin

Less version

> less --version 
less 590 (PCRE2 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

thanks for this awesome tool.

@edentsai edentsai added the bug Something isn't working label Feb 27, 2022
@sharkdp
Copy link
Owner

sharkdp commented Mar 6, 2022

Thank you for this bug report. I would hope that this is easy to fix.

@sharkdp sharkdp added the good first issue Good for newcomers label Mar 6, 2022
@beowolx
Copy link

beowolx commented Mar 21, 2022

Hi there 😃

I'd like to take this one, please

@keith-hall
Copy link
Collaborator

Hi there 😃

I'd like to take this one, please

Hi, sounds great! Please let us know if you have any questions or need any help :)

@beowolx
Copy link

beowolx commented Mar 26, 2022

HI @keith-hall and thanks again to let me take it :)

I'm sorry, It was a pretty tough week at my job and I only had the time to check the issue this morning.

I'm gonna work on it today :)

As it is my first contribution, any advices to solve this one?

@Melkor333
Copy link

Shouldn't this issue be closed with #2260 ?

@keith-hall
Copy link
Collaborator

Yep, looks like it should. Fix released in bat v0.22.0.
Sorry for not getting back to you with advice @luiscardosooliveira

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

No branches or pull requests

5 participants