Command-line interface for BusyTag device management. Control your BusyTag displays, upload files, manage storage, update firmware, and more.
$ dotnet add package BusyTag.CLIThis directory contains the BusyTag CLI application source code and comprehensive technical documentation.
BusyTag.CLI/
├── Program.cs # Main application entry point
├── BusyTag.CLI.csproj # Project configuration
└── README.md # This file
Install using Homebrew for the easiest setup on macOS:
# Add the BusyTag tap
brew tap busy-tag/busytag
# Install BusyTag CLI
brew install busytag-cli
# Verify installation
busytag-cli --version
# Update to latest version
brew update && brew upgrade busytag-cli
# Uninstall if needed
brew uninstall busytag-cli
✅ Advantages:
Install as a global tool using the .NET CLI (requires .NET 8.0+ runtime):
# Install .NET 8.0+ first if not already installed
# Download from: https://dotnet.microsoft.com/download
# Install the latest version
dotnet tool install -g BusyTag.CLI
# Verify installation
busytag-cli --version
# Update to latest version
dotnet tool update -g BusyTag.CLI
# Uninstall if needed
dotnet tool uninstall -g BusyTag.CLI
For development or building from source:
# Clone the repository
git clone https://github.com/busy-tag/busytag-cli.git
cd busytag-cli/BusyTag.CLI
# Build and run
dotnet build -c Release
dotnet run -- --help
# Or build self-contained executable
dotnet publish -c Release --self-contained -r win-x64 # Windows
dotnet publish -c Release --self-contained -r osx-x64 # macOS Intel
dotnet publish -c Release --self-contained -r osx-arm64 # macOS Apple Silicon
dotnet publish -c Release --self-contained -r linux-x64 # Linux
busytag-cli scan # Scan for devices
busytag-cli list # Alias for scanbusytag-cli connect <port> # Connect to specific device
busytag-cli info <port> # Show device information
busytag-cli restart <port> # Restart device remotelybusytag-cli color <port> <color> [brightness] [led_bits]Color Formats:
red, green, blue, yellow, cyan, magenta, white, offFF0000, #FF0000255,0,0Parameters:
brightness: 0-100 (default: 100)led_bits: 1-127 (default: 127, controls which LEDs to light)Examples:
busytag-cli color COM3 red # Full red
busytag-cli color COM3 red 75 # Red at 75% brightness
busytag-cli color COM3 FF0000 50 127 # Hex red, 50% brightness, all LEDs
busytag-cli color COM3 255,128,0 # Orange using RGB
busytag-cli color COM3 blue 100 64 # Blue on specific LED patternbusytag-cli brightness <port> <level> # Set brightness (0-100)busytag-cli pattern <port> <pattern_name> # Apply LED patternAvailable patterns:
DefaultPolice 1Police 2Red flashesGreen flashesBlue flashesYellow flashesCyan flashesMagenta flashesWhite flashesRed runningGreen runningBlue runningYellow runningCyan runningMagenta runningWhite runningRed pulsesGreen pulsesBlue pulsesYellow pulsesCyan pulsesMagenta pulsesWhite pulsesbusytag-cli show <port> <filename> # Display image file
busytag-cli display <port> <filename> # Alias for showbusytag-cli upload <port> <file_path> # Upload file to deviceSupported formats:
busytag-cli download <port> <filename> <destination_path>busytag-cli files <port> # List all files
busytag-cli ls <port> # Alias for filesbusytag-cli delete <port> <filename> # Delete specific file
busytag-cli remove <port> <filename> # Alias for deletebusytag-cli storage <port> # Show storage statistics
busytag-cli space <port> # Alias for storagebusytag-cli format <port> --force # Format device storage (DESTRUCTIVE!)busytag-cli firmware <port> <firmware.bin> # Upload firmware update⚠️ Important Notes:
busytag-cli version # Show CLI version
busytag-cli --version # Alternative version command
busytag-cli -v # Short version command
busytag-cli help # Show help information
busytag-cli --help # Alternative help command
busytag-cli -h # Short help commandLaunch interactive mode for guided operations:
busytag-cliInteractive Mode Features:
Set environment variables for default behavior:
# Windows
set BUSYTAG_DEFAULT_PORT=COM3
set BUSYTAG_TIMEOUT=5000
set BUSYTAG_SCAN_INTERVAL=3000
set BUSYTAG_DEBUG=1
# macOS/Linux
export BUSYTAG_DEFAULT_PORT="/dev/cu.usbserial-xyz" # macOS
# export BUSYTAG_DEFAULT_PORT="/dev/ttyUSB0" # Linux
export BUSYTAG_TIMEOUT=5000
export BUSYTAG_SCAN_INTERVAL=3000
export BUSYTAG_DEBUG=1# Clone repository
git clone https://github.com/busy-tag/busytag-cli.git
cd busytag-cli/BusyTag.CLI
# Restore dependencies
dotnet restore
# Build in Debug mode
dotnet build
# Build in Release mode
dotnet build -c Release
# Run tests
dotnet test
# Run the application
dotnet run -- <arguments>Create platform-specific executables:
# Windows x64
dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true
# macOS x64 (Intel)
dotnet publish -c Release -r osx-x64 --self-contained true -p:PublishSingleFile=true
# macOS ARM64 (Apple Silicon)
dotnet publish -c Release -r osx-arm64 --self-contained true -p:PublishSingleFile=true
# Linux x64
dotnet publish -c Release -r linux-x64 --self-contained true -p:PublishSingleFile=trueCreate a appsettings.Development.json file for development settings:
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"BusyTag": "Trace"
}
},
"BusyTag": {
"DefaultTimeout": 10000,
"ScanInterval": 2000,
"MaxRetries": 3
}
}The project uses the following key dependencies:
| Exit Code | Description | Common Causes |
|---|---|---|
| 0 | Success | Operation completed successfully |
| 1 | General error | Invalid arguments, connection failure |
| 2 | Device not found | No device detected, wrong port |
| 3 | Permission denied | Insufficient permissions, driver issues |
| 4 | File operation failed | File not found, storage full |
| 5 | Communication timeout | Device not responding, cable issues |
| 6 | Invalid format | Unsupported file format |
| 7 | Device busy | Another operation in progress |
Main device interface class providing all device operations.
Key Methods:
Connect() - Establish device connectionDisconnect() - Close device connectionSendRgbColorAsync(r, g, b, ledBits) - Set RGB colorSetSolidColorAsync(colorName, brightness, ledBits) - Set named colorSendNewFile(filePath) - Upload file to deviceGetFileListAsync() - Retrieve device file listDeleteFile(filename) - Delete file from deviceGetFileAsync(filename) - Download file from deviceShowPictureAsync(filename) - Display image fileFormatDiskAsync() - Format device storageRestartDeviceAsync() - Restart deviceDevice discovery and management class.
Key Methods:
FindBusyTagDevice() - Scan for available devicesStartPeriodicDeviceSearch(interval) - Auto-discoveryStopPeriodicDeviceSearch() - Stop auto-discoveryThe application supports various configuration options through environment variables and command-line arguments:
# Environment Variables
BUSYTAG_DEFAULT_PORT # Default device port
BUSYTAG_TIMEOUT # Connection timeout (ms)
BUSYTAG_SCAN_INTERVAL # Device scan interval (ms)
BUSYTAG_DEBUG # Enable debug logging (1/0)
BUSYTAG_MAX_RETRIES # Maximum retry attempts
BUSYTAG_LOG_LEVEL # Logging level (Debug/Info/Warning/Error)This project is licensed under the MIT License. See the main repository LICENSE file for details.
# Check available space before large uploads
busytag-cli storage COM3
# Use appropriate file formats
# PNG: Best for static images, smaller file sizes
# GIF: Required for animations, larger file sizes
# Optimize images before upload
# Use tools like pngquant, imageoptim, or tinypng# Group related operations to reduce connection overhead
# Good:
busytag-cli upload COM3 file1.png
busytag-cli upload COM3 file2.png
busytag-cli show COM3 file1.png
# Better: Use scripts that maintain connection state
# (Interactive mode handles this automatically)# For automation, use environment variables to reduce setup time
export BUSYTAG_DEFAULT_PORT="COM3"
export BUSYTAG_TIMEOUT="10000"
# Then commands don't need port specification
busytag-cli color red 75
busytag-cli upload image.pngThe CLI application is designed to be lightweight:
dialout group# Use absolute paths in automation scripts
busytag-cli upload COM3 "/full/path/to/file.png"
# Validate inputs in scripts
if [[ -f "$UPLOAD_FILE" ]]; then
busytag-cli upload "$PORT" "$UPLOAD_FILE"
else
echo "Error: File not found: $UPLOAD_FILE"
exit 1
fi
# Set appropriate file permissions
chmod 600 /path/to/automation-script.shThe CLI currently supports English output. For international users:
Configure logging levels and outputs:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"BusyTag.CLI": "Debug",
"BusyTag.Lib": "Information"
},
"Console": {
"IncludeScopes": true
},
"File": {
"Path": "/var/log/busytag-cli.log",
"MaxFileSize": "10MB",
"MaxRollingFiles": 5
}
}
}For automation and monitoring, the CLI provides:
# Example: Monitoring script performance
start_time=$(date +%s)
busytag-cli upload COM3 large-file.png
end_time=$(date +%s)
duration=$((end_time - start_time))
echo "Upload took ${duration} seconds"Update installation:
# For Homebrew users
brew update && brew upgrade busytag-cli
# For .NET tool users
dotnet tool update -g BusyTag.CLI
Check for breaking changes:
Update automation scripts:
Before major updates:
# Backup current configuration
cp ~/.busytag/config.json ~/.busytag/config.json.backup
# Backup automation scripts
tar -czf busytag-scripts-backup.tar.gz /path/to/scripts/
# Test new version in isolation
busytag-cli --version
busytag-cli helpWhen reporting bugs, include:
# System information
busytag-cli --version
uname -a # Linux/macOS
systeminfo # Windows
# Device information
busytag-cli scan
busytag-cli info <port>
# Error logs (if available)
cat /var/log/busytag-cli.log
# Steps to reproduce
# Expected vs actual behavior
# Screenshots or terminal outputMade with ❤️ by BUSY TAG SIA
For questions or support, please open an issue or check our documentation.