Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package bat-extras for openSUSE:Factory checked in at 2023-09-20 13:30:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/bat-extras (Old) and /work/SRC/openSUSE:Factory/.bat-extras.new.16627 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "bat-extras" Wed Sep 20 13:30:52 2023 rev:5 rq:1112363 version:2023.09.19 Changes: -------- --- /work/SRC/openSUSE:Factory/bat-extras/bat-extras.changes 2023-06-20 16:47:24.255017385 +0200 +++ /work/SRC/openSUSE:Factory/.bat-extras.new.16627/bat-extras.changes 2023-09-20 13:34:38.042348412 +0200 @@ -1,0 +2,13 @@ +Tue Sep 19 18:38:24 UTC 2023 - Jan-Luca Kiok <opensuse-packa...@jlk.one> + +- Update to version 2023.09.19 + * batman: Split short options + * batdiff: Show error when not in git repo + * batdiff: Support filtering diffs by directory + * batdiff: Check delta version for --hunk-style + * batman: Document issues with non-default themes + * batpipe: Add support for gzipped and bzipped tar files + * batpipe: Extract batpipe_archive_header() helper function + * all: Use eza instead of exa + +------------------------------------------------------------------- Old: ---- v2023.06.15.tar.gz New: ---- v2023.09.19.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ bat-extras.spec ++++++ --- /var/tmp/diff_new_pack.4i03qf/_old 2023-09-20 13:34:39.350395274 +0200 +++ /var/tmp/diff_new_pack.4i03qf/_new 2023-09-20 13:34:39.350395274 +0200 @@ -17,7 +17,7 @@ Name: bat-extras -Version: 2023.06.15 +Version: 2023.09.19 Release: 0 Summary: Extra scripts for bat License: MIT ++++++ v2023.06.15.tar.gz -> v2023.09.19.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bat-extras-2023.06.15/doc/batman.md new/bat-extras-2023.09.19/doc/batman.md --- old/bat-extras-2023.06.15/doc/batman.md 2023-06-16 02:15:14.000000000 +0200 +++ new/bat-extras-2023.09.19/doc/batman.md 2023-09-19 19:57:28.000000000 +0200 @@ -21,6 +21,21 @@ +## Customization + +### Changing the Theme + +You can change the syntax highlighting theme for `batman` by setting the `BAT_THEME` environment variable before calling `batman`. The following wrapper function will change the theme to `Solarized (dark)` without affecting any other `bat` command. + +```bash +batman() { + BAT_THEME="Solarized (dark)" batman "$@" + return $? +} +``` + + + ## Installation @@ -28,6 +43,18 @@ +## Caveats + +**Flags aren't highlighted:** + +- This happens when you change `bat`'s theme through `bat`'s config file or the `BAT_THEME` environment variable. Not all themes provide colours for flags, and [it's a known issue](https://github.com/sharkdp/bat/issues/2115). +- You can overriding the theme for `batman` by wrapping it in a function that sets `BAT_THEME`. +- The following themes support manpage highlighting: + - `Monokai Extended` / ``Monokai Extended Light` + - `Solarized (dark)` / `Solarized (light)` + + + ## Acknowledgements Thanks to [@sharkdp](https://github.com/sharkdp) and [@LunarLambda](https://github.com/LunarLambda) for debugging how to make this work properly in [certain environments](https://github.com/sharkdp/bat/issues/652). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bat-extras-2023.06.15/doc/batpipe.md new/bat-extras-2023.09.19/doc/batpipe.md --- old/bat-extras-2023.06.15/doc/batpipe.md 2023-06-16 02:15:14.000000000 +0200 +++ new/bat-extras-2023.09.19/doc/batpipe.md 2023-09-19 19:57:28.000000000 +0200 @@ -29,7 +29,7 @@ | Files | Program | | -------------------- | --------------------------- | -| Directories | `exa`, `ls` | +| Directories | `eza`, `ls` | | `*.tar`, `*.tar.gz` | `tar` | | `*.zip`, `*.jar` | `unzip` | | `*.gz` | `gunzip` | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bat-extras-2023.06.15/src/batdiff.sh new/bat-extras-2023.09.19/src/batdiff.sh --- old/bat-extras-2023.06.15/src/batdiff.sh 2023-06-16 02:15:14.000000000 +0200 +++ new/bat-extras-2023.09.19/src/batdiff.sh 2023-09-19 19:57:28.000000000 +0200 @@ -34,6 +34,7 @@ BAT_VERSION="$(bat_version)" BAT_ARGS=() DELTA_ARGS=() +DELTA_VERSION='unsupported' GIT_ARGS=() FILES=() @@ -50,6 +51,15 @@ # Set options based on delta availability. if command -v "$EXECUTABLE_DELTA" &>/dev/null; then SUPPORTS_DELTA=true + DELTA_VERSION="$("$EXECUTABLE_DELTA" --version | cut -d' ' -f2)" +fi + +# Set options based on delta version. +# - 0.12 -- Renamed `--hunk-style` to `--hunk-header-decoration-style`. +if version_compare "$DELTA_VERSION" -ge "0.12"; then + DELTA_ARGS+=("--hunk-header-decoration-style=plain") +else + DELTA_ARGS+=("--hunk-style=plain") fi # Parse arguments. @@ -82,8 +92,7 @@ BAT_ARGS+=("--terminal-width=${OPT_TERMINAL_WIDTH}" "--paging=never") DELTA_ARGS+=( "--width=${OPT_TERMINAL_WIDTH}" - "--paging=never" - "--hunk-header-decoration-style=plain" + "--paging=never" ) if "$OPT_COLOR"; then @@ -102,8 +111,23 @@ GIT_ARGS+=(-U"$OPT_CONTEXT") # ----------------------------------------------------------------------------- +# Functions: +# ----------------------------------------------------------------------------- + +ensure_git_directory() { + if ! "$EXECUTABLE_GIT" rev-parse --show-toplevel &>/dev/null; then + print_error "Not a git repository." + printc "\n%s\nTo view a diff between two files, use %{CYAN}%s [file] [file]%{CLEAR}." \ + "To view a diff between staged files and the working directory, enter a git repository." \ + "$PROGRAM" + exit 1 + fi +} + +# ----------------------------------------------------------------------------- # Printing: # ----------------------------------------------------------------------------- + print_bat_diff() { local files=("$@") @@ -114,6 +138,7 @@ fi # Diff staged git file. + ensure_git_directory if "$OPT_STAGED"; then if false && "$SUPPORTS_DELTA"; then # bat doesn't support diffing staged changes against the HEAD. @@ -130,7 +155,8 @@ # Diff git file. if "$SUPPORTS_BAT_DIFF"; then - "$EXECUTABLE_BAT" --diff --diff-context="$OPT_CONTEXT" "${files[0]}" "${BAT_ARGS[@]}" + "$EXECUTABLE_GIT" diff "${GIT_ARGS[@]}" --name-only "${files[0]}" \ + | xargs "$EXECUTABLE_BAT" --diff --diff-context="$OPT_CONTEXT" "${BAT_ARGS[@]}" else "$EXECUTABLE_GIT" diff "${GIT_ARGS[@]}" "${files[0]}" | "$EXECUTABLE_BAT" --language=diff - "${BAT_ARGS[@]}" fi @@ -146,6 +172,7 @@ fi # Diff git file. + ensure_git_directory "$EXECUTABLE_GIT" diff "${GIT_ARGS[@]}" "${files[0]}" | "$EXECUTABLE_DELTA" "${DELTA_ARGS[@]}" } @@ -183,6 +210,7 @@ # ----------------------------------------------------------------------------- main() { if [[ "${#FILES[@]}" -eq 0 ]] || "$OPT_ALL_CHANGES"; then + ensure_git_directory local file while read -r file; do if [[ -f "$file" ]]; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bat-extras-2023.06.15/src/batgrep.sh new/bat-extras-2023.09.19/src/batgrep.sh --- old/bat-extras-2023.06.15/src/batgrep.sh 2023-06-16 02:15:14.000000000 +0200 +++ new/bat-extras-2023.09.19/src/batgrep.sh 2023-09-19 19:57:28.000000000 +0200 @@ -47,7 +47,7 @@ Path(s) to search Options: - -i, --ingore-case: + -i, --ignore-case: Use case insensitive searching. -s, --case-sensitive: @@ -93,10 +93,10 @@ --pager=[PAGER]: Specify the pager to use. - --terminal-wdith=[COLS]: + --terminal-width=[COLS]: Generate output for the specified terminal width. - --no-seperator: + --no-separator: Disable printing separator between files Options passed directly to ripgrep: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bat-extras-2023.06.15/src/batman.sh new/bat-extras-2023.09.19/src/batman.sh --- old/bat-extras-2023.06.15/src/batman.sh 2023-06-16 02:15:14.000000000 +0200 +++ new/bat-extras-2023.09.19/src/batman.sh 2023-09-19 19:57:28.000000000 +0200 @@ -24,6 +24,7 @@ MAN_ARGS=() BAT_ARGS=() +SHIFTOPT_SHORT_OPTIONS="SPLIT" while shiftopt; do case "$OPT" in --paging|--pager) shiftval; FORWARDED_ARGS+=("${OPT}=${OPT_VAL}"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bat-extras-2023.06.15/src/batpipe.sh new/bat-extras-2023.09.19/src/batpipe.sh --- old/bat-extras-2023.06.15/src/batpipe.sh 2023-06-16 02:15:14.000000000 +0200 +++ new/bat-extras-2023.09.19/src/batpipe.sh 2023-09-19 19:57:28.000000000 +0200 @@ -151,7 +151,12 @@ # Viewers: # ----------------------------------------------------------------------------- -BATPIPE_VIEWERS=("exa" "ls" "tar" "unzip" "gunzip" "xz") +if ! command -v eza &> /dev/null +then + BATPIPE_VIEWERS=("eza" "ls" "tar" "tar_gz" "unzip" "gunzip" "xz") +else + BATPIPE_VIEWERS=("exa" "ls" "tar" "tar_bz2" "unzip" "gunzip" "xz") +fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -161,6 +166,12 @@ return 0 } +viewer_eza_supports() { + [[ -d "$2" ]] || return 1 + command -v "eza" &> /dev/null || return 1 + return 0 +} + viewer_exa_process() { local dir="$(strip_trailing_slashes "$1")" batpipe_header "Viewing contents of directory: %{PATH}%s" "$dir" @@ -171,6 +182,16 @@ fi return $? } +viewer_eza_process() { + local dir="$(strip_trailing_slashes "$1")" + batpipe_header "Viewing contents of directory: %{PATH}%s" "$dir" + if "$BATPIPE_ENABLE_COLOR"; then + eza -la --color=always "$1" 2>&1 + else + eza -la --color=never "$1" 2>&1 + fi + return $? +} # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -200,17 +221,50 @@ viewer_tar_process() { if [[ -n "$2" ]]; then - tar -xf "$1" -O "$2" | bat --file-name="$1/$2" + tar $3 -xf "$1" -O "$2" | bat --file-name="$1/$2" else - batpipe_header "Viewing contents of archive: %{PATH}%s" "$1" - batpipe_subheader "To view files within the archive, add the file path after the archive." - tar -tvf "$1" + batpipe_archive_header + tar $3 -tvf "$1" return $? fi } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +viewer_tar_gz_supports() { + command -v "tar" &> /dev/null || return 1 + command -v "gzip" &> /dev/null || return 1 + + case "$1" in + *.tar.gz | *.tgz) return 0 ;; + esac + + return 1 +} + +viewer_tar_gz_process() { + viewer_tar_process "$1" "$2" -z +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +viewer_tar_bz2_supports() { + command -v "tar" &> /dev/null || return 1 + command -v "bzip2" &> /dev/null || return 1 + + case "$1" in + *.tar.bz2 | *.tbz) return 0 ;; + esac + + return 1 +} + +viewer_tar_bz2_process() { + viewer_tar_process "$1" "$2" -j +} + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + viewer_unzip_supports() { command -v "unzip" &> /dev/null || return 1 @@ -225,8 +279,7 @@ if [[ -n "$2" ]]; then unzip -p "$1" "$2" | bat --file-name="$1/$2" else - batpipe_header "Viewing contents of archive: %{PATH}%s" "$1" - batpipe_subheader "To view files within the archive, add the file path after the archive." + batpipe_archive_header unzip -l "$1" return $? fi @@ -290,6 +343,11 @@ printc "%{SUBHEADER}==> $pattern%{C}\n" "${@:2}" } +batpipe_archive_header() { + batpipe_header "Viewing contents of archive: %{PATH}%s" "$1" + batpipe_subheader "To view files within the archive, add the file path after the archive." +} + # Executes `bat` (or `cat`, if already running from within `bat`). # Supports the `--file-name` argument if the bat version is new enough. # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bat-extras-2023.06.15/test/snapshot/batgrep/test_help.stdout.snapshot new/bat-extras-2023.09.19/test/snapshot/batgrep/test_help.stdout.snapshot --- old/bat-extras-2023.06.15/test/snapshot/batgrep/test_help.stdout.snapshot 2023-06-16 02:15:14.000000000 +0200 +++ new/bat-extras-2023.09.19/test/snapshot/batgrep/test_help.stdout.snapshot 2023-09-19 19:57:28.000000000 +0200 @@ -13,7 +13,7 @@ Path(s) to search Options: - -i, --ingore-case: + -i, --ignore-case: Use case insensitive searching. -s, --case-sensitive: @@ -59,10 +59,10 @@ --pager=[PAGER]: Specify the pager to use. - --terminal-wdith=[COLS]: + --terminal-width=[COLS]: Generate output for the specified terminal width. - --no-seperator: + --no-separator: Disable printing separator between files Options passed directly to ripgrep: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bat-extras-2023.06.15/version.txt new/bat-extras-2023.09.19/version.txt --- old/bat-extras-2023.06.15/version.txt 2023-06-16 02:15:14.000000000 +0200 +++ new/bat-extras-2023.09.19/version.txt 2023-09-19 19:57:28.000000000 +0200 @@ -1 +1 @@ -2023.03.21 +2023.09.19