system-toast/README.md

99 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# System Toast
一个轻量级的跨平台系统通知工具使用Go语言开发可以通过命令行发送系统通知。
## 特性
- 🚀 轻量级,无第三方依赖
- 🌐 跨平台支持Windows、macOS、Linux
- 📝 简单易用的命令行接口
- 🔧 支持自定义通知标题和内容
## 系统要求
- Go 1.21 或更高版本
## 安装
### 从源码编译
```bash
git clone http://47.107.61.133:3000/lirh/system-toast.git
cd system-toast
go build -o system-toast main.go
```
### 使用预编译二进制文件
从项目的 [Releases](http://47.107.61.133:3000/lirh/system-toast/releases) 页面下载适合您系统的预编译二进制文件。
## 使用方法
### 基本用法
```bash
# 发送简单通知
./system-toast -message "该喝水了!"
# 发送带标题的通知
./system-toast -message "会议时间到了" -title "工作提醒"
```
### 参数说明
| 参数 | 类型 | 必需 | 默认值 | 说明 |
|------|------|------|--------|------|
| `-message` | 字符串 | 是 | - | 通知消息内容 |
| `-title` | 字符串 | 否 | "提醒" | 通知标题 |
### 使用示例
```bash
# 健康提醒
./system-toast -message "站起来活动一下,保护你的腰部" -title "健康提醒"
# 工作提醒
./system-toast -message "15分钟后有重要会议" -title "会议提醒"
# 生活提醒
./system-toast -message "记得今天要交水电费" -title "生活提醒"
```
## 技术实现
本项目根据不同操作系统调用相应的系统通知API
- **Windows**: 使用PowerShell的Toast通知
- **macOS**: 通过osascript调用系统通知
- **Linux**: 使用notify-send命令
## 开发
### 项目结构
```
system-toast/
├── main.go # 主程序入口
├── go.mod # Go模块定义
├── README.md # 项目文档
├── build.bat # Windows构建脚本
├── build.sh # Unix/Linux/macOS构建脚本
└── dist/ # 构建输出目录
```
### 构建脚本
项目提供了便捷的构建脚本:
- Windows: `build.bat`
- Unix/Linux/macOS: `build.sh`
这些脚本会自动为多个目标平台构建二进制文件并输出到dist目录。
## 许可证
本项目采用开源许可证详见LICENSE文件。
## 贡献
欢迎提交Issue和Pull Request来改进这个项目