1
0
mirror of https://github.com/sharkdp/bat synced 2026-06-09 10:03:18 +00:00
Commit Graph

3763 Commits

Author SHA1 Message Date
Víctor González Prieto ffed52f6eb Document how to contribute syntax mappings 2026-03-18 21:58:23 +02:00
Víctor González Prieto a4e853c4fa Map ignore files to Git Ignore syntax
This would catch any dotfiles that end in "ignore", but not `.ignore`

Set as a lower priority rule (90 vs the usual 50) because it's a blanket
assignation. If there are conflict with other, more specific rules,
those will take precedence.
2026-03-18 21:58:23 +02:00
Keith Hall f11374535d Merge pull request #3629 from Rohan5commit/docs/fix-readme-wording
docs: fix README sidebar wording
2026-03-18 20:37:04 +02:00
rohan436 de209f8a23 docs: fix README sidebar wording 2026-03-18 20:15:53 +02:00
Keith Hall 63d5796f8f Merge pull request #3635 from victor-gp/add-mappings-for-gcloud-cli
Add syntax mappings for GCloud CLI config files
2026-03-17 22:45:12 +02:00
Víctor González Prieto a1917275cd Add syntax mappings for GCloud CLI config files
> .boto => INI

I was uninstalling gcloud-cli and the docs said to review the contents
of ~/.boto [^1].

`bat` doesn't recognize it but it's just an INI-like file to configure
gsutil [^2].

I took the chance to add a few more mappings for other GCloud config
files without extension...

> .gcloudignore => Git Ignore

This one's self-explanatory, but it's documented in [^3].

Makes me wonder if we could just do a blanket `Git Ignore = ".?*ignore"`
for every kind of ignore file. For instance, `bat` doesn't catch
.dockerignore either.

> **/gcloud/configurations/config_* => INI

These are configuration files for each different profile you have
configured for the gcloud-cli [^4].

They're named like "config_default" or "config_<name>", without a
file extension, but they are also INI syntax [^5][^6].

[^1]: https://docs.cloud.google.com/sdk/docs/uninstall-cloud-sdk
[^2]: https://docs.cloud.google.com/storage/docs/boto-gsutil
[^3]: https://docs.cloud.google.com/sdk/gcloud/reference/topic/gcloudignore
[^4]: https://docs.cloud.google.com/sdk/docs/configurations
[^5]: https://stackoverflow.com/questions/74290882/return-active-gcp-project-name-programatically-for-both-local-dev-and-deployed-c/7^4292151#74292151
[^6]: https://stackoverflow.com/questions/49212350/where-does-gcloud-store-its-defaults/49256835#49256835
2026-03-17 20:51:23 +01:00
Keith Hall d9adfe90fc Merge pull request #3627 from XploitMonk0x01/codex/clarify-theme-format
docs: clarify supported custom theme format
2026-03-14 09:08:30 +02:00
XploitMonk0x01 b1f04995a6 docs: clarify supported custom theme format 2026-03-14 11:44:38 +05:30
auto-merge-dependabot-prs[bot] ea6d2ac911 Merge pull request #3605 from sharkdp/dependabot/submodules/assets/syntaxes/02_Extra/cmd-help-db0a616
build(deps): bump assets/syntaxes/02_Extra/cmd-help from `273cb98` to `db0a616`
2026-03-11 17:06:16 +00:00
dependabot[bot] ac97356930 build(deps): bump assets/syntaxes/02_Extra/cmd-help
Bumps [assets/syntaxes/02_Extra/cmd-help](https://github.com/victor-gp/cmd-help-sublime-syntax) from `273cb98` to `db0a616`.
- [Commits](https://github.com/victor-gp/cmd-help-sublime-syntax/compare/273cb988177e96f4187e06008b13fa72ad22ae4d...db0a616cfa367a4f52fd81d1a46c8ebea11e867d)

---
updated-dependencies:
- dependency-name: assets/syntaxes/02_Extra/cmd-help
  dependency-version: db0a616cfa367a4f52fd81d1a46c8ebea11e867d
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-11 16:54:46 +00:00
Keith Hall 23abbdcea9 Merge pull request #3584 from adukhan99/add-cobol-syntax
Add COBOL syntax highlighting
2026-03-11 18:51:14 +02:00
Alex Dukhan 927873392b Drop .ss extension from COBOL 2026-03-11 15:06:47 +00:00
Alex Dukhan 91965d28a6 Add COBOL sans CPY ext 2026-03-11 14:36:20 +00:00
Alex Dukhan 88ff40f93e Merge branch 'master' into add-cobol-syntax 2026-03-11 11:26:01 +00:00
Keith Hall 0dcdcb678a Merge pull request #3621 from Xavrir/fix-symlink-syntax-detection
Fix syntax highlighting for symlinked files by resolving target path
2026-03-08 20:01:25 +02:00
Rizky Mirzaviandy Priambodo f49641a6c3 Fix syntax highlighting for symlinked files by resolving target path
When a symlink name has no recognizable extension (e.g. Aliases/0install),
syntax detection fails because the symlink path doesn't match any syntax.
The target file may have a recognizable extension (e.g. Formula/zero-install.rb)
but was never consulted.

When path-based syntax detection fails with UndetectedSyntax, canonicalize
the path to resolve symlinks and retry detection with the target path.
This preserves existing behavior where the symlink path itself matches
(e.g. .ssh/config), since the original path is tried first.

Closes #1001
2026-03-09 00:01:09 +07:00
Keith Hall fc4f12b390 Merge pull request #3620 from Xavrir/fix-bat-config-dir-duplicate
Fix BAT_CONFIG_DIR pointing at system config directory causing duplicate flag errors
2026-03-08 08:23:14 +02:00
Rizky Mirzaviandy Priambodo 9cce9e04d2 Fix BAT_CONFIG_DIR pointing at system config dir causing duplicate flag errors
When BAT_CONFIG_DIR is set to the system config directory (e.g. /etc/bat),
both system_config_file() and config_file() resolve to /etc/bat/config.
The config file was read twice, causing clap errors for non-repeatable flags
like --italic-text.

Skip the user config read when it resolves to the same file as the system
config, using canonicalization to also handle symlinks.

Closes #3589
2026-03-08 12:20:27 +07:00
Rizky Mirzaviandy Priambodo 844bfded50 Add --fallback-syntax for undetected files (#3617)
* feat(cli): add fallback syntax option

Expose a new fallback syntax CLI option so users can opt into syntax highlighting only when auto-detection fails.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

* feat(syntax): apply fallback only after detection fails

Use the fallback syntax only when path and first-line detection fail, preserving existing behavior for detected files and explicit language selection.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

* test(cli): cover fallback syntax behavior

Add integration coverage for fallback syntax usage, precedence with --language, and no-op behavior when syntax is already detected; update help snapshots for the new option.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

* docs(changelog): document fallback syntax option

Record the new fallback syntax feature in the unreleased changelog section.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

---------

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-08 05:18:29 +02:00
Matei6942 ab80bd9717 feat(syntax): add support for hidden_file_extensions (#3613)
* feat(syntax): add support for hidden_file_extensions
2026-03-06 20:14:20 +02:00
foxfromworld a1a10c777f Docs: clarify PATH requirement and explain highlighted outputs (Fixes… (#3610)
* Docs: clarify PATH requirement and explain highlighted outputs (Fixes #2376)

* Update CHANGELOG for PR #3610

* Apply suggestion from @keith-hall

Applied reviewer’s suggestion to improve PATH export: safer with quotes and more convenient with $(pwd).

Co-authored-by: Keith Hall <keith-hall@users.noreply.github.com>

* Docs: clarify PATH setup in CONTRIBUTING.md, remove that section from README.md

* Docs: add cross reference to syntax tests step 5 in doc/assets.md

---------

Co-authored-by: Keith Hall <keith-hall@users.noreply.github.com>
2026-03-05 05:55:05 +00:00
Varun Chawla cc5f782d28 Add word wrapping mode (#3597)
* feat: add word wrapping mode for --wrap flag

* Run `cargo fmt` and add CHANGELOG entry

* Add word wrap tests, update manpage and shell completions

- Add integration tests for word wrapping: basic word boundary breaking,
  fallback to character wrapping for long words, line numbers, and
  short lines that fit without wrapping
- Update manpage to document the new 'word' wrapping mode
- Update bash, fish, zsh, and PowerShell completions with 'word' option
- Avoid unnecessary clone of `line_buf` when word wrap is disabled

* make clippy and cargo fmt happy

---------

Co-authored-by: Keith Hall <keith-hall@users.noreply.github.com>
2026-03-03 05:18:49 +02:00
Keith Hall 1424f9d6bf Merge pull request #3609 from Nicolas0315/fix/builtin-pager-drop-panic
Fix panic in BuiltinPager Drop when pager thread fails (#3449)
2026-03-02 04:57:37 +02:00
Nicolas fd67095cff Fix panic in BuiltinPager drop when pager thread panics
The Drop impl for OutputType::BuiltinPager calls
handle.take().unwrap().join().unwrap() which panics if the
pager thread itself panicked. In Drop, this causes a double
panic (abort).

Replace with if-let and discard the join result, matching the
pattern used for OutputType::Pager which also uses let _ =.

Reported in #3449 where BAT_PAGER=builtin with --help
causes the pager thread to fail.

Fixes #3449
2026-03-02 04:12:50 +09:00
auto-merge-dependabot-prs[bot] 908b1f22d1 Merge pull request #3608 from sharkdp/dependabot/cargo/bytesize-2.3.1
build(deps): bump bytesize from 1.3.0 to 2.3.1
2026-03-01 04:47:12 +00:00
dependabot[bot] 17a70d9b8c build(deps): bump bytesize from 1.3.0 to 2.3.1
Bumps [bytesize](https://github.com/bytesize-rs/bytesize) from 1.3.0 to 2.3.1.
- [Release notes](https://github.com/bytesize-rs/bytesize/releases)
- [Changelog](https://github.com/bytesize-rs/bytesize/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bytesize-rs/bytesize/compare/v1.3.0...bytesize-v2.3.1)

---
updated-dependencies:
- dependency-name: bytesize
  dependency-version: 2.3.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-01 04:36:13 +00:00
auto-merge-dependabot-prs[bot] 49d77a469a Merge pull request #3607 from sharkdp/dependabot/cargo/clap-4.5.60
build(deps): bump clap from 4.5.56 to 4.5.60
2026-03-01 04:33:43 +00:00
dependabot[bot] fa35495888 build(deps): bump clap from 4.5.56 to 4.5.60
Bumps [clap](https://github.com/clap-rs/clap) from 4.5.56 to 4.5.60.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.56...clap_complete-v4.5.60)

---
updated-dependencies:
- dependency-name: clap
  dependency-version: 4.5.60
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-01 04:18:28 +00:00
auto-merge-dependabot-prs[bot] 8a858b19dc Merge pull request #3606 from sharkdp/dependabot/cargo/git2-0.20.4
build(deps): bump git2 from 0.20.3 to 0.20.4
2026-03-01 04:16:23 +00:00
dependabot[bot] 397252d2cc build(deps): bump git2 from 0.20.3 to 0.20.4
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.20.3 to 0.20.4.
- [Changelog](https://github.com/rust-lang/git2-rs/blob/git2-0.20.4/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/git2-rs/compare/git2-0.20.3...git2-0.20.4)

---
updated-dependencies:
- dependency-name: git2
  dependency-version: 0.20.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-01 04:00:55 +00:00
auto-merge-dependabot-prs[bot] 5e59957349 Merge pull request #3603 from sharkdp/dependabot/cargo/nix-0.31.2
build(deps): bump nix from 0.30.1 to 0.31.2
2026-03-01 03:58:09 +00:00
dependabot[bot] 90f8e00e0c build(deps): bump nix from 0.30.1 to 0.31.2
Bumps [nix](https://github.com/nix-rust/nix) from 0.30.1 to 0.31.2.
- [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/compare/v0.30.1...v0.31.2)

---
updated-dependencies:
- dependency-name: nix
  dependency-version: 0.31.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-01 03:35:51 +00:00
auto-merge-dependabot-prs[bot] 673929c189 Merge pull request #3604 from sharkdp/dependabot/cargo/serde_with-3.17.0
build(deps): bump serde_with from 3.16.1 to 3.17.0
2026-03-01 03:32:28 +00:00
dependabot[bot] e36bb8cc66 build(deps): bump serde_with from 3.16.1 to 3.17.0
Bumps [serde_with](https://github.com/jonasbb/serde_with) from 3.16.1 to 3.17.0.
- [Release notes](https://github.com/jonasbb/serde_with/releases)
- [Commits](https://github.com/jonasbb/serde_with/compare/v3.16.1...v3.17.0)

---
updated-dependencies:
- dependency-name: serde_with
  dependency-version: 3.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-01 03:04:00 +00:00
Keith Hall 7d7e202bd5 Merge pull request #3588 from IMaloney/fix/warn-missing-pager
warn when pager is missing instead of silently falling back
2026-02-20 20:46:38 +02:00
Keith Hall 74de075748 Merge branch 'master' into fix/warn-missing-pager 2026-02-20 20:37:07 +02:00
Keith Hall 594069581d Merge pull request #3592 from IMaloney/fix/wrap-never-clean
respect --wrap=never flag when piping to pager
2026-02-20 20:26:23 +02:00
Ian Maloney 62b0388236 remove code comments 2026-02-20 06:12:14 +00:00
Ian Maloney 16d041492c fix pr number in changelog 2026-02-20 06:07:23 +00:00
Ian Maloney 22ee03ff00 add changelog entry for wrap-never bug fix 2026-02-20 06:04:29 +00:00
Ian Maloney 790bed3a2d fix: respect --wrap=never flag when paging is enabled
When output is piped to a pager, the wrapping_mode logic was not checking the explicit --wrap=never flag and would always default to NoWrapping(false). This meant the -S flag was not passed to less, causing lines to wrap despite the user's explicit request.

The fix prioritizes explicit CLI flags (--wrap=never, --chop-long-lines) over the interactive_output-based logic, ensuring they are always respected.

Fixes #3587
2026-02-20 06:04:14 +00:00
Ian Maloney bc84854d4b use cat as test pager instead of builtin (builtin is interactive, doesnt output to stdout) 2026-02-20 00:19:47 +00:00
Ian Maloney 319811df01 fix test: use builtin pager instead of less, revert to warn for all missing pagers 2026-02-20 00:09:02 +00:00
Ian Maloney 2c1a8caadd simplify: just never warn for less (universal default) 2026-02-19 22:49:02 +00:00
Ian Maloney a240aa4afd never warn for missing 'less' pager (common default) 2026-02-19 22:21:17 +00:00
Ian Maloney 00e38cd056 only warn for explicitly configured pagers, not defaults 2026-02-19 22:01:58 +00:00
Ian Maloney 335eff51f3 fix type error, pager.bin is already a string 2026-02-19 21:44:47 +00:00
Ian Maloney d04b960c05 warn when pager is missing instead of silently falling back
when a configured pager (via BAT_PAGER, PAGER, or --pager) is not found,
bat now shows a warning message before falling back to stdout. this helps
users understand why their pager isn't running and makes it obvious when
there's a typo or PATH issue.

fixes issue #2904
2026-02-19 21:29:59 +00:00
Keith Hall fbc05da785 Merge pull request #3586 from BlueElectivire/master
Fixed manpage syntax to remove ANSI artifacts
2026-02-19 18:56:14 +02:00
Guy Barzilai a71d16fa1b Fixed manpage syntax-test format 2026-02-19 18:11:36 +02:00