refactor: rebrand bash-helper to super-man + ESC returns straight to menu
Rename bash-helper.sh -> super-man.sh and update all docs/tests to the super-man name and alias. In interactive mode, pressing Esc in the flag browser now returns directly to the home menu, removing the intermediary "Press Enter to search another command" prompt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Interactive mode testing for Bash Buddy
|
||||
# Interactive mode testing for Super Man
|
||||
# Tests fzf-based interactive mode with automation
|
||||
|
||||
# Get script directory
|
||||
@@ -10,7 +10,7 @@ PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
source "$SCRIPT_DIR/test-framework.sh"
|
||||
|
||||
# Set script path
|
||||
SCRIPT_PATH="$PROJECT_DIR/bash-helper.sh"
|
||||
SCRIPT_PATH="$PROJECT_DIR/super-man.sh"
|
||||
|
||||
print_header
|
||||
echo "Testing Interactive Mode"
|
||||
@@ -51,12 +51,12 @@ echo -e "\n${CYAN}Test #1: Launch interactive mode and exit immediately${NC}"
|
||||
TEST_LOG="$TEST_LOG_DIR/interactive_launch_test.log"
|
||||
|
||||
# Create expect script for immediate exit
|
||||
cat > /tmp/bhelper_test_exit.exp << 'EOF'
|
||||
cat > /tmp/super-man_test_exit.exp << 'EOF'
|
||||
#!/usr/bin/expect -f
|
||||
set timeout 10
|
||||
log_user 0
|
||||
|
||||
spawn bash -c "./bash-helper.sh"
|
||||
spawn bash -c "./super-man.sh"
|
||||
expect {
|
||||
timeout { exit 1 }
|
||||
eof { exit 0 }
|
||||
@@ -68,11 +68,11 @@ expect {
|
||||
}
|
||||
EOF
|
||||
|
||||
chmod +x /tmp/bhelper_test_exit.exp
|
||||
chmod +x /tmp/super-man_test_exit.exp
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
start_time=$(get_ms_timestamp)
|
||||
/tmp/bhelper_test_exit.exp > "$TEST_LOG" 2>&1
|
||||
/tmp/super-man_test_exit.exp > "$TEST_LOG" 2>&1
|
||||
exit_code=$?
|
||||
end_time=$(get_ms_timestamp)
|
||||
duration=$((end_time - start_time))
|
||||
@@ -98,12 +98,12 @@ echo -e "\n${CYAN}Test #2: Select command and view flags${NC}"
|
||||
TEST_LOG="$TEST_LOG_DIR/interactive_select_test.log"
|
||||
|
||||
# Create expect script to select grep and search for -v
|
||||
cat > /tmp/bhelper_test_select.exp << 'EOF'
|
||||
cat > /tmp/super-man_test_select.exp << 'EOF'
|
||||
#!/usr/bin/expect -f
|
||||
set timeout 15
|
||||
log_user 1
|
||||
|
||||
spawn bash -c "./bash-helper.sh"
|
||||
spawn bash -c "./super-man.sh"
|
||||
|
||||
# Wait for fzf to start
|
||||
sleep 2
|
||||
@@ -126,11 +126,11 @@ send "\x03"
|
||||
expect eof
|
||||
EOF
|
||||
|
||||
chmod +x /tmp/bhelper_test_select.exp
|
||||
chmod +x /tmp/super-man_test_select.exp
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
start_time=$(get_ms_timestamp)
|
||||
/tmp/bhelper_test_select.exp > "$TEST_LOG" 2>&1
|
||||
/tmp/super-man_test_select.exp > "$TEST_LOG" 2>&1
|
||||
exit_code=$?
|
||||
end_time=$(get_ms_timestamp)
|
||||
duration=$((end_time - start_time))
|
||||
@@ -157,12 +157,12 @@ echo -e "\n${CYAN}Test #3: Filter commands by category${NC}"
|
||||
TEST_LOG="$TEST_LOG_DIR/interactive_filter_test.log"
|
||||
|
||||
# Create expect script to filter by "network"
|
||||
cat > /tmp/bhelper_test_filter.exp << 'EOF'
|
||||
cat > /tmp/super-man_test_filter.exp << 'EOF'
|
||||
#!/usr/bin/expect -f
|
||||
set timeout 15
|
||||
log_user 1
|
||||
|
||||
spawn bash -c "./bash-helper.sh"
|
||||
spawn bash -c "./super-man.sh"
|
||||
|
||||
# Wait for fzf to start
|
||||
sleep 2
|
||||
@@ -179,11 +179,11 @@ send "\x03"
|
||||
expect eof
|
||||
EOF
|
||||
|
||||
chmod +x /tmp/bhelper_test_filter.exp
|
||||
chmod +x /tmp/super-man_test_filter.exp
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
start_time=$(get_ms_timestamp)
|
||||
/tmp/bhelper_test_filter.exp > "$TEST_LOG" 2>&1
|
||||
/tmp/super-man_test_filter.exp > "$TEST_LOG" 2>&1
|
||||
exit_code=$?
|
||||
end_time=$(get_ms_timestamp)
|
||||
duration=$((end_time - start_time))
|
||||
@@ -213,12 +213,12 @@ SUCCESS_COUNT=0
|
||||
for cmd in "${COMMANDS_TO_TEST[@]}"; do
|
||||
TEST_LOG="$TEST_LOG_DIR/interactive_${cmd}_test.log"
|
||||
|
||||
cat > /tmp/bhelper_test_${cmd}.exp << EOF
|
||||
cat > /tmp/super-man_test_${cmd}.exp << EOF
|
||||
#!/usr/bin/expect -f
|
||||
set timeout 10
|
||||
log_user 1
|
||||
|
||||
spawn bash -c "./bash-helper.sh"
|
||||
spawn bash -c "./super-man.sh"
|
||||
sleep 2
|
||||
send "${cmd}\r"
|
||||
sleep 1
|
||||
@@ -228,10 +228,10 @@ send "\x03"
|
||||
expect eof
|
||||
EOF
|
||||
|
||||
chmod +x /tmp/bhelper_test_${cmd}.exp
|
||||
chmod +x /tmp/super-man_test_${cmd}.exp
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
/tmp/bhelper_test_${cmd}.exp > "$TEST_LOG" 2>&1
|
||||
/tmp/super-man_test_${cmd}.exp > "$TEST_LOG" 2>&1
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
|
||||
@@ -267,22 +267,22 @@ SUCCESS_COUNT=0
|
||||
for i in {1..5}; do
|
||||
TEST_LOG="$TEST_LOG_DIR/interactive_perf_$i.log"
|
||||
|
||||
cat > /tmp/bhelper_perf_test.exp << 'EOF'
|
||||
cat > /tmp/super-man_perf_test.exp << 'EOF'
|
||||
#!/usr/bin/expect -f
|
||||
set timeout 10
|
||||
log_user 0
|
||||
|
||||
spawn bash -c "./bash-helper.sh"
|
||||
spawn bash -c "./super-man.sh"
|
||||
sleep 1
|
||||
send "\x03"
|
||||
expect eof
|
||||
EOF
|
||||
|
||||
chmod +x /tmp/bhelper_perf_test.exp
|
||||
chmod +x /tmp/super-man_perf_test.exp
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
start_time=$(get_ms_timestamp)
|
||||
/tmp/bhelper_perf_test.exp > "$TEST_LOG" 2>&1
|
||||
/tmp/super-man_perf_test.exp > "$TEST_LOG" 2>&1
|
||||
exit_code=$?
|
||||
end_time=$(get_ms_timestamp)
|
||||
duration=$((end_time - start_time))
|
||||
@@ -306,7 +306,7 @@ if [ $SUCCESS_COUNT -gt 0 ]; then
|
||||
fi
|
||||
|
||||
# Cleanup temp files
|
||||
rm -f /tmp/bhelper_*.exp
|
||||
rm -f /tmp/super-man_*.exp
|
||||
|
||||
# ============================================================================
|
||||
# SUMMARY
|
||||
|
||||
Reference in New Issue
Block a user