forked from JinFanZheng/web-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
38 lines (31 loc) · 1.03 KB
/
main.go
File metadata and controls
38 lines (31 loc) · 1.03 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
package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/vanzheng/web-tools/cmd/web-reader"
"github.com/vanzheng/web-tools/cmd/web-search"
)
var version = "dev"
func main() {
rootCmd := &cobra.Command{
Use: "web-tools",
Short: "Local-first web tools for AI agents",
Long: `web-tools provides web-search and web-reader as CLI tools, designed for AI agents to consume.
Zero cost. No API keys. No third-party dependencies.`,
Example: ` web-tools web-search "latest AI news" --limit 3
web-tools web-search "人工智能" --locale zh-CN --time-range week
web-tools web-search "site:reuters.com Iran" --category news
web-tools web-reader https://example.com/article
web-tools web-reader https://example.com/spa-page --browser
web-tools web-reader ./report.pdf
web-tools web-reader ./slides.pptx -o /tmp/slides.md`,
Version: version,
}
rootCmd.AddCommand(webreader.Cmd())
rootCmd.AddCommand(websearch.Cmd())
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}