diff --git a/README.md b/README.md index e7a8675..5fb2d0b 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,9 @@ Zsh: | `colcon build --symlink-install` | `cb` | | `colcon build --symlink-install --packages-select` | `cbp`| package 1 [Optional] ... package n [Optional] | | `colcon build --symlink-install --packages-skip` | `cbs`| package 1 [Optional] ... package n [Optional] | +| `colcon test` | `ct` | +| `colcon test --packages-select` | `ctp`| package 1 [Optional] ... package n [Optional] | +| `colcon test --packages-skip` | `cts`| package 1 [Optional] ... package n [Optional] | | `colcon list` | `cl` | ## Rosdep diff --git a/ros2_utils.bash b/ros2_utils.bash index 79c995a..49a6a48 100644 --- a/ros2_utils.bash +++ b/ros2_utils.bash @@ -241,6 +241,42 @@ function cbs { history -s $CMD } +function ct { + CMD="colcon test" + echo $CMD + $CMD + history -s ct $@ + history -s $CMD +} + +function ctp { + if [ $# -eq 0 ]; then + PACKAGE=$(colcon list -n | fzf) + [[ -z "$PACKAGE" ]] && return + local CMD="colcon test --packages-select $PACKAGE" + else + local CMD="colcon test --packages-select $@" + fi + echo $CMD + $CMD + history -s ctp $@ + history -s $CMD +} + +function cts { + if [ $# -eq 0 ]; then + PACKAGE=$(colcon list -n | fzf) + [[ -z "$PACKAGE" ]] && return + local CMD="colcon test --packages-skip $PACKAGE" + else + local CMD="colcon test --packages-skip $@" + fi + echo $CMD + $CMD + history -s cts $@ + history -s $CMD +} + function cl { CMD="colcon list -n" echo $CMD diff --git a/ros2_utils.zsh b/ros2_utils.zsh index 6941b8e..47b0513 100644 --- a/ros2_utils.zsh +++ b/ros2_utils.zsh @@ -240,6 +240,42 @@ function cbs { print -s $CMD } +function ct { + CMD=(colcon test) + echo $CMD + $CMD + print -s ct + print -s $CMD +} + +function ctp { + if [ $# -eq 0 ]; then + PACKAGE=$(colcon list -n | fzf) + [[ -z "$PACKAGE" ]] && return + CMD="colcon test --packages-select $PACKAGE" + else + CMD="colcon test --packages-select $@" + fi + echo $CMD + eval $CMD + print -s ctp $@ + print -s $CMD +} + +function cts { + if [ $# -eq 0 ]; then + PACKAGE=$(colcon list -n | fzf) + [[ -z "$PACKAGE" ]] && return + CMD="colcon test --packages-skip $PACKAGE" + else + CMD="colcon test --packages-skip $@" + fi + echo $CMD + eval $CMD + print -s cts $@ + print -s $CMD +} + function cl { CMD=(colcon list -n) echo $CMD