Skip to main content
Glama
help.exp13.1 kB
#!/usr/bin/env expect # Exit codes: # 0 - Test passed # 1 - Test failed # Set timeout for command execution set timeout 30 # Colors for output set GREEN "\033\[0;32m" set RED "\033\[0;31m" set YELLOW "\033\[1;33m" set BLUE "\033\[0;34m" set NC "\033\[0m" # Get the gbox binary path # Default to using the built binary in the parent directory set gbox_binary "../gbox" # If the built binary doesn't exist, fall back to system gbox if {![file exists $gbox_binary]} { set gbox_binary "gbox" } puts "${BLUE}Testing gbox help command...${NC}" # Test 1: Basic help command puts "\n${YELLOW}Testing basic help command...${NC}" puts "${BLUE}Running Test 1: Basic help command${NC}" if {[catch { spawn $gbox_binary help set header_found 0 set usage_found 0 set commands_found 0 set flags_found 0 set help_text_found 0 expect { -re "GBOX CLI Tool" { puts "${GREEN}✓ Found GBOX CLI Tool header${NC}" set header_found 1 exp_continue } -re "Usage:" { puts "${GREEN}✓ Found Usage section${NC}" set usage_found 1 exp_continue } -re "Available Commands:" { puts "${GREEN}✓ Found Available Commands section${NC}" set commands_found 1 exp_continue } -re "Flags:" { puts "${GREEN}✓ Found Flags section${NC}" set flags_found 1 exp_continue } -re "Use.*--help.*for more information" { puts "${GREEN}✓ Found help instruction text${NC}" set help_text_found 1 exp_continue } eof { puts "${GREEN}✓ Help command completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for help output${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ Basic help test failed: $result${NC}" exit 1 } # Test 2: Help command with --help flag puts "\n${YELLOW}Testing help command with --help flag...${NC}" puts "${BLUE}Running Test 2: Help command with --help flag${NC}" if {[catch { spawn $gbox_binary --help set header_found 0 set usage_found 0 set commands_found 0 set flags_found 0 expect { -re "GBOX CLI Tool" { puts "${GREEN}✓ Found GBOX CLI Tool header with --help flag${NC}" set header_found 1 exp_continue } -re "Usage:" { puts "${GREEN}✓ Found Usage section with --help flag${NC}" set usage_found 1 exp_continue } -re "Available Commands:" { puts "${GREEN}✓ Found Available Commands section with --help flag${NC}" set commands_found 1 exp_continue } -re "Flags:" { puts "${GREEN}✓ Found Flags section with --help flag${NC}" set flags_found 1 exp_continue } eof { puts "${GREEN}✓ Help command with --help flag completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for --help flag output${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ Help with --help flag test failed: $result${NC}" exit 1 } # Test 3: Help command with -h flag puts "\n${YELLOW}Testing help command with -h flag...${NC}" puts "${BLUE}Running Test 3: Help command with -h flag${NC}" if {[catch { spawn $gbox_binary -h expect { -re "GBOX CLI Tool" { puts "${GREEN}✓ Found GBOX CLI Tool header with -h flag${NC}" exp_continue } -re "Usage:" { puts "${GREEN}✓ Found Usage section with -h flag${NC}" exp_continue } -re "Available Commands:" { puts "${GREEN}✓ Found Available Commands section with -h flag${NC}" exp_continue } eof { puts "${GREEN}✓ Help command with -h flag completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for -h flag output${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ Help with -h flag test failed: $result${NC}" exit 1 } # Test 4: Check for specific commands in help output puts "\n${YELLOW}Testing for specific commands in help output...${NC}" puts "${BLUE}Running Test 4: Check for specific commands in help output${NC}" if {[catch { spawn $gbox_binary help set box_found 0 set mcp_found 0 set version_found 0 set help_found 0 expect { -re "box.*Box operations" { puts "${GREEN}✓ Found box command in help output${NC}" set box_found 1 exp_continue } -re "mcp.*MCP operations" { puts "${GREEN}✓ Found mcp command in help output${NC}" set mcp_found 1 exp_continue } -re "version.*Show version information" { puts "${GREEN}✓ Found version command in help output${NC}" set version_found 1 exp_continue } -re "help.*Show help information" { puts "${GREEN}✓ Found help command in help output${NC}" set help_found 1 exp_continue } eof { puts "${GREEN}✓ Command checking completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for command list${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ Command checking test failed: $result${NC}" exit 1 } # Test 5: Check for version flag in help output puts "\n${YELLOW}Testing for version flag in help output...${NC}" puts "${BLUE}Running Test 5: Check for version flag in help output${NC}" if {[catch { spawn $gbox_binary help expect { -re "-v, --version.*Print version information" { puts "${GREEN}✓ Found version flag in help output${NC}" exp_continue } eof { puts "${GREEN}✓ Version flag checking completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for version flag${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ Version flag test failed: $result${NC}" exit 1 } # Test 6: Help for box subcommand puts "\n${YELLOW}Testing help for box subcommand...${NC}" puts "${BLUE}Running Test 6: Help for box subcommand${NC}" if {[catch { spawn $gbox_binary box --help set box_usage_found 0 set box_commands_found 0 set box_flags_found 0 expect { -re "Usage:.*gbox box" { puts "${GREEN}✓ Found box command usage${NC}" set box_usage_found 1 exp_continue } -re "Available Commands:" { puts "${GREEN}✓ Found Available Commands section for box${NC}" set box_commands_found 1 exp_continue } -re "Flags:" { puts "${GREEN}✓ Found Flags section for box${NC}" set box_flags_found 1 exp_continue } eof { puts "${GREEN}✓ Box help command completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for box help output${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ Box help test failed: $result${NC}" exit 1 } # Test 7: Help for mcp subcommand puts "\n${YELLOW}Testing help for mcp subcommand...${NC}" puts "${BLUE}Running Test 7: Help for mcp subcommand${NC}" if {[catch { spawn $gbox_binary mcp --help expect { -re "Usage:.*gbox mcp" { puts "${GREEN}✓ Found mcp command usage${NC}" exp_continue } -re "Available Commands:" { puts "${GREEN}✓ Found Available Commands section for mcp${NC}" exp_continue } eof { puts "${GREEN}✓ MCP help command completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for mcp help output${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ MCP help test failed: $result${NC}" exit 1 } # Test 8: Help for version command puts "\n${YELLOW}Testing help for version command...${NC}" puts "${BLUE}Running Test 8: Help for version command${NC}" if {[catch { spawn $gbox_binary version --help expect { -re "Usage:.*gbox version" { puts "${GREEN}✓ Found version command usage${NC}" exp_continue } -re "Show version information" { puts "${GREEN}✓ Found version command description${NC}" exp_continue } eof { puts "${GREEN}✓ Version help command completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for version help output${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ Version help test failed: $result${NC}" exit 1 } # Test 9: Help for box create subcommand puts "\n${YELLOW}Testing help for box create subcommand...${NC}" puts "${BLUE}Running Test 9: Help for box create subcommand${NC}" if {[catch { spawn $gbox_binary box create --help expect { -re "Usage:.*gbox box create" { puts "${GREEN}✓ Found box create command usage${NC}" exp_continue } -re "Create a new box" { puts "${GREEN}✓ Found box create command description${NC}" exp_continue } -re "Flags:" { puts "${GREEN}✓ Found Flags section for box create${NC}" exp_continue } eof { puts "${GREEN}✓ Box create help command completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for box create help output${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ Box create help test failed: $result${NC}" exit 1 } # Test 10: Help for box list subcommand puts "\n${YELLOW}Testing help for box list subcommand...${NC}" puts "${BLUE}Running Test 10: Help for box list subcommand${NC}" if {[catch { spawn $gbox_binary box list --help expect { -re "Usage:.*gbox box list" { puts "${GREEN}✓ Found box list command usage${NC}" exp_continue } -re "List all available boxes" { puts "${GREEN}✓ Found box list command description${NC}" exp_continue } -re "Flags:" { puts "${GREEN}✓ Found Flags section for box list${NC}" exp_continue } eof { puts "${GREEN}✓ Box list help command completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for box list help output${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ Box list help test failed: $result${NC}" exit 1 } # Test 11: Invalid help command (should show error) puts "\n${YELLOW}Testing invalid help command...${NC}" puts "${BLUE}Running Test 11: Invalid help command${NC}" if {[catch { spawn $gbox_binary help invalid-command expect { -re "Error:" { puts "${GREEN}✓ Found expected error for invalid help command${NC}" exp_continue } -re "unknown command" { puts "${GREEN}✓ Found expected unknown command error${NC}" exp_continue } eof { puts "${GREEN}✓ Invalid help command error displayed correctly${NC}" } timeout { puts "${RED}✗ Timeout waiting for invalid help command error${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ Invalid help command test failed: $result${NC}" exit 1 } # Test 12: Help command with no arguments (should show main help) puts "\n${YELLOW}Testing help command with no arguments...${NC}" puts "${BLUE}Running Test 12: Help command with no arguments${NC}" if {[catch { spawn $gbox_binary help expect { -re "GBOX CLI Tool" { puts "${GREEN}✓ Found main help output with no arguments${NC}" exp_continue } -re "Usage:" { puts "${GREEN}✓ Found Usage section with no arguments${NC}" exp_continue } eof { puts "${GREEN}✓ Help command with no arguments completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for help with no arguments${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ Help with no arguments test failed: $result${NC}" exit 1 } puts "\n${GREEN}All help tests passed successfully!${NC}" exit 0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/babelcloud/gru-sandbox'

If you have feedback or need assistance with the MCP directory API, please join our Discord server