id = "bat" name = "bat" homepage = "https://github.com/sharkdp/bat" description = "A cat(1) clone with syntax highlighting and Git integration." icon = "SimpleIcons:bat" # Debian and Ubuntu ship the binary as `batcat` to avoid a name clash. executables = ["bat", "batcat"] [dotfiles] # The README only says "call `bat --config-file`", so the paths come from the # source: src/bin/bat/directories.rs builds the config dir from # `etcetera::choose_base_strategy()` (`$BAT_CONFIG_DIR` wins), which is the XDG # base directory on Linux *and* macOS and the Windows known folders on Windows — # %APPDATA% for config, %LOCALAPPDATA% for cache. The config file is `config` # inside it; custom themes and syntaxes go in `themes/` and `syntaxes/` # (README: `mkdir -p "$(bat --config-dir)/themes"`). paths = [ "[configHome]/bat/config", "[configHome]/bat/themes/", "[configHome]/bat/syntaxes/", ] # `bat cache --build` writes the compiled syntax/theme set here. It is derived # from the files above and is rebuilt by the tool, and its binary dumps are tied # to the installed bat version. # # [xdgCache], not [cacheHome]: the latter is the platform's own cache # directory, which on macOS is ~/Library/Caches. bat's # `choose_base_strategy()` is XDG everywhere, so its cache is $XDG_CACHE_HOME, # else ~/.cache/bat, on a Mac too, and [cacheHome] would name a directory bat # never writes. Windows is the one platform where the strategy leaves XDG, so # %LOCALAPPDATA% is spelled out beside it. exclude = [ "[xdgCache]/bat/", "%LOCALAPPDATA%/bat/", ] # The config file is a list of command line arguments. bat has no credentials. secret = [] # Read once per invocation, so rewriting it between runs is harmless. side_effect = false # No machine_lines: everything in the config file (theme, style, italics, # syntax mappings) is a preference the user wants on every machine. [commands] format = 1 label = "View files" description = "Print files with syntax highlighting, line numbers and Git markers. Theme and syntax listing, custom mappings and diagnostics are left out." quality = "ai-draft" base = "fig:bat" parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = true, short_bundles = true } [[commands.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/bat.ts" license = "MIT" [[commands.field]] id = "files" label = "Files" description = "Leave empty to read standard input." type = "path" position = 0 multiple = true path = { kind = "file", role = "input", must_exist = true } sources = ["fig"] [[commands.field]] id = "language" label = "Language" description = "Force a syntax for highlighting, for example json or rust." type = "string" option = ["--language", "-l"] sources = ["fig"] [[commands.field]] id = "number" label = "Line numbers only" type = "boolean" option = ["--number", "-n"] sources = ["fig"] [[commands.field]] id = "plain" label = "Plain output" description = "No decorations." type = "boolean" option = ["--plain", "-p"] sources = ["fig"] [[commands.field]] id = "line_range" label = "Line range" description = "Only print these lines, for example 10:20." type = "string" option = ["--line-range", "-r"] sources = ["fig"] [[commands.field]] id = "highlight_line" label = "Highlight lines" description = "Highlight a line or range, for example 5:8." type = "string" option = ["--highlight-line", "-H"] sources = ["fig"] [[commands.field]] id = "diff" label = "Show Git changes" type = "boolean" option = ["--diff", "-d"] sources = ["fig"] [[commands.field]] id = "show_all" label = "Show non-printable characters" type = "boolean" option = ["--show-all", "-A"] sources = ["fig"] [[commands.field]] id = "theme" label = "Theme" type = "string" option = ["--theme"] sources = ["fig"] [[commands.field]] id = "paging" label = "Paging" type = "enum" option = ["--paging"] choices = [{ value = "auto", label = "Auto" }, { value = "always", label = "Always" }, { value = "never", label = "Never" }] sources = ["fig"] [[commands.field]] id = "tabs" label = "Tab width" type = "integer" option = ["--tabs"] sources = ["fig"] [[commands.task]] id = "view" label = "View a file" fields = ["files", "language", "line_range", "highlight_line"] required = ["files"] [[commands.task]] id = "no-pager" label = "Print without pager" set = { paging = ["never"] } fields = ["files", "paging", "plain"] required = ["files"] [[commands.group]] id = "basic" label = "Basic" fields = ["files", "language", "number", "plain", "line_range", "highlight_line"] [[commands.group]] id = "advanced" label = "Advanced" fields = ["diff", "show_all", "theme", "paging", "tabs"]