PVCheevos/CLI-DEMO.md
The ra-cli tool provides a comprehensive command-line interface for testing and exploring the RetroAchievements API. Here's how to use it effectively:
First, you'll need:
# Build the CLI tool
swift build
# Test the help system
swift run ra-cli --help
# View your profile (default command)
swift run ra-cli -u your_username -k your_api_key
# Or explicitly specify the profile command
swift run ra-cli -u your_username -k your_api_key -c profile
Example Output:
š Validating credentials...
ā
Credentials validated successfully!
š¤ USER PROFILE
āāāāāāāāāāāāāāā
š® Username: MaxMilyin
š
Member Since: 2020-01-15 10:30:00
š Total Points: 125,847
šÆ Softcore Points: 45,230
š True Points: 138,592
š® Currently: Playing Super Mario Bros. (NES)
š Motto: "Gotta catch 'em all... achievements!"
šØāš» Contributions: 234
š§ Permissions Level: 1
# View detailed awards information
swift run ra-cli -u your_username -k your_api_key -c awards
Example Output:
š
USER AWARDS
āāāāāāāāāāāāāā
š Total Awards: 87
š Mastery Awards: 12
šÆ Completion Awards: 23
šŖ Hardcore Beat Awards: 8
š Softcore Beat Awards: 15
šŖ Event Awards: 2
š Site Awards: 27
š Recent Awards:
1. Super Mario Bros. Mastery (Game Mastery) - 2023-12-15 14:22:00
2. Speed Demon (Site Award) - 2023-12-10 09:15:00
3. Zelda Completion (Game Completion) - 2023-12-08 20:45:00
...
# View social connections (following/followers)
swift run ra-cli -u your_username -k your_api_key -c social
Example Output:
š„ SOCIAL CONNECTIONS
āāāāāāāāāāāāāāāāāāāā
š¤ Following 15 users:
1. RetroGamer123 - 95,230 points
2. AchievementHunter - 145,670 points
3. SpeedRunner99 - 87,421 points
...
š„ 23 followers:
1. GameCollector - 52,340 points
2. CasualPlayer - 23,120 points
3. RetroFan - 78,945 points
...
# Interactive game lookup
swift run ra-cli -u your_username -k your_api_key -c game
Example Session:
š® GAME INFORMATION
āāāāāāāāāāāāāāāāāā
Enter a game ID to explore (e.g., 1 for Super Mario Bros.): 1
š® Game: Super Mario Bros.
š¹ Console: NES (ID: 7)
šØāš» Developer: Nintendo
š¢ Publisher: Nintendo
š Genre: Platform
š
Released: 1985
š Total Achievements: 30
š„ Casual Players: 15,234
šŖ Hardcore Players: 8,567
š Sample Achievements:
⢠World 1-1 (5 pts) - Complete World 1-1
⢠First Life (10 pts) - Get your first 1up
⢠Coin Collector (5 pts) - Collect 100 coins
⢠Fire Flower (10 pts) - Get the Fire Flower power-up
⢠World 1 Complete (25 pts) - Complete all of World 1
... and 25 more achievements
# Interactive achievement lookup
swift run ra-cli -u your_username -k your_api_key -c achievement
Example Session:
š ACHIEVEMENT INFORMATION
āāāāāāāāāāāāāāāāāāāāāāāāā
Enter an achievement ID to explore: 12345
š Achievement: Speed Demon
š Description: Complete World 1-1 in under 400 seconds
š Points: 25
š
True Ratio: 50
šØāš» Author: RetroAchievementDev
š
Created: 2019-03-15 12:00:00
š Modified: 2023-01-10 15:30:00
š„ Total Unlocks: 1,247
šŖ Hardcore Unlocks: 892
š Recent Unlocks:
1. SpeedRunner123 šŖ - 2023-12-20 14:30:00
2. QuickGamer š - 2023-12-20 13:45:00
3. FastPlayer šŖ - 2023-12-20 12:15:00
...
š® From Game: Super Mario Bros. (ID: 1)
š¹ Console: NES
# Get everything at once
swift run ra-cli -u your_username -k your_api_key -c all
This command shows:
For convenience, set up environment variables:
# Set up your credentials
export RA_USERNAME=your_username
export RA_API_KEY=your_api_key
# Now you can use shorter commands
swift run ra-cli -c profile
swift run ra-cli -c awards
swift run ra-cli -c social
swift run ra-cli -c all
| Command | Alias | Description |
|---|---|---|
profile | p | Show user profile information |
awards | a | Show user awards and achievements |
social | s | Show social connections |
game | g | Interactive game exploration |
achievement | ach | Interactive achievement exploration |
all | - | Show profile, awards, and social info |
The CLI tool is perfect for:
Use the CLI to:
Invalid Credentials:
ā Invalid credentials! Please check your username and API key.
Network Errors:
š Network error: The Internet connection appears to be offline.
Rate Limiting:
ā± Rate limit exceeded - please wait before making more requests
# Always available help
swift run ra-cli --help
# Or just
swift run ra-cli -h
The CLI tool demonstrates exactly how to integrate PVCheevos into the Provenance app:
This makes the CLI tool an invaluable resource for planning and implementing RetroAchievements support in Provenance! š®