-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
45 lines (41 loc) · 1.34 KB
/
Copy pathmain.go
File metadata and controls
45 lines (41 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"fmt"
"log"
"os"
)
func main() {
// Check for MCP mode first
for _, arg := range os.Args[1:] {
if arg == "--mcp" {
if err := RunMCPServer(); err != nil {
log.Fatalf("MCP server error: %v", err)
}
return
}
if arg == "--help" || arg == "-h" {
showMainUsage()
os.Exit(0)
}
}
// Default to CLI mode
if err := RunCLI(); err != nil {
log.Fatalf("CLI error: %v", err)
}
}
// showMainUsage displays the main usage information
func showMainUsage() {
fmt.Fprintf(os.Stderr, "Usage: %s [mode] [options]\n\n", os.Args[0])
fmt.Fprintln(os.Stderr, "A CLI tool and MCP server for searching internet radio stations via radio-browser.")
fmt.Fprintln(os.Stderr, "\nModes:")
fmt.Fprintln(os.Stderr, " Default (no flags) Run as CLI tool")
fmt.Fprintln(os.Stderr, " --mcp Run as MCP server")
fmt.Fprintln(os.Stderr, " --help Show this help")
fmt.Fprintln(os.Stderr, "\nCLI Examples:")
fmt.Fprintln(os.Stderr, " bradio --name 'Milano Lounge'")
fmt.Fprintln(os.Stderr, " bradio --tag 'ambient' --limit 30")
fmt.Fprintln(os.Stderr, "\nMCP Server Examples:")
fmt.Fprintln(os.Stderr, " bradio --mcp # Start MCP server with stdio transport")
fmt.Fprintln(os.Stderr, "\nFor mode-specific help:")
fmt.Fprintln(os.Stderr, " bradio --help # CLI help")
}