rcaloras / bash-preexec

⚡ preexec and precmd functions for Bash just like Zsh.
MIT License
862 stars 94 forks source link

Update to remove shellcheck warnings #135

Closed adamprice2 closed 2 years ago

adamprice2 commented 2 years ago

Hi, I went ahead and fixed the shellcheck warnings mentioned in https://github.com/rcaloras/bash-preexec/issues/132

Changes to actual code were minimal (couple of quotes and a newline I think).

Test suite runs correctly on my system. bats test ✓ sourcing bash-preexec should exit with 1 if we're not using bash ✓ bp_install should exit if it's already installed ✓ bp_install should remove trap logic and itself from PROMPT_COMMAND ✓ bp_install should preserve an existing DEBUG trap ✓ bp_sanitize_string should remove semicolons and trim space ✓ Appending to PROMPT_COMMAND should work after bp_install ✓ Appending or prepending to PROMPT_COMMAND should work after bp_install_after_session_init ✓ Adding to PROMPT_COMMAND before and after initiating install ✓ Adding to PROMPT_COMMAND after with semicolon ✓ during install PROMPT_COMMAND and precmd functions should be executed each once ✓ No functions defined for preexec should simply return ✓ precmd should execute a function once ✓ precmd should set $? to be the previous exit code ✓ precmd should set $BPPIPESTATUS to the previous $PIPESTATUS ✓ precmd should set $ to be the previous last arg ✓ preexec should execute a function with the last command in our history ✓ preexec should execute multiple functions in the order added to their arrays ✓ preecmd should execute multiple functions in the order added to their arrays ✓ preexec should execute a function with IFS defined to local scope ✓ precmd should execute a function with IFS defined to local scope ✓ preexec should set $? to be the exit code of preexec_functions ✓ in_prompt_command should detect if a command is part of PROMPT_COMMAND ✓ __bp_adjust_histcontrol should remove ignorespace and ignoreboth ✓ preexec should respect HISTTIMEFORMAT ✓ preexec should not strip whitespace from commands ✓ preexec should preserve multi-line strings in commands ✓ preexec should work on options to 'echo' commands ✓ should not import if it's already defined ✓ should import if not defined ✓ bp should stop installation if HISTTIMEFORMAT is readonly

30 tests, 0 failures

rcaloras commented 2 years ago

@adamprice2 thanks for the PR and contribution! @akinomyoga Thanks for your continued input and great feedback on this project.

Feel free to submit further PRs for any of the other small updates here as mentioned.

rcaloras commented 2 years ago

LGTM 👍