Skip to content

batwatch: Show 'Command:' instead of 'File:' in header of command mode#148

Open
frankenstein91 wants to merge 1 commit into
eth-p:masterfrom
frankenstein91:fix-batwatch
Open

batwatch: Show 'Command:' instead of 'File:' in header of command mode#148
frankenstein91 wants to merge 1 commit into
eth-p:masterfrom
frankenstein91:fix-batwatch

Conversation

@frankenstein91

Copy link
Copy Markdown

Description

When running batwatch --command <cmd>, the header rendered by bat displays File: <cmd>. Since it is executing a command rather than displaying a file, it is more appropriate and intuitive to display Command: <cmd>.

This PR post-processes the bat output in batwatch's command execution loop using a portable sed replacement that targets only the first 5 lines (the header block), changing File: to Command:.

Changes

  • src/batwatch.sh: Added a portable Basic Regular Expression (BRE) sed filter in the output capturing pipeline to replace the File: label with Command:.
  • test/suite/batwatch.sh: Added the test:command_header test case to verify that the header correctly uses Command: when executing a command.

Verification

Tested both the raw script and the compiled version using the test suite:

  • ./test.sh (all batwatch tests pass)
  • ./build.sh && ./test.sh --compiled (all batwatch tests pass)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant