docs: 重写README文档
- 更新项目名称为System Toast - 添加特性列表和系统要求说明 - 优化安装和使用说明,增加参数表格 - 添加项目结构和开发说明 - 改进格式和可读性
This commit is contained in:
parent
235d5fad30
commit
95cc640f2c
105
README.md
105
README.md
|
|
@ -1,72 +1,99 @@
|
||||||
# location-notice
|
# System Toast
|
||||||
|
|
||||||
本地提醒小程序
|
一个轻量级的跨平台系统通知工具,使用Go语言开发,可以通过命令行发送系统通知。
|
||||||
|
|
||||||
## 功能介绍
|
## 特性
|
||||||
|
|
||||||
这是一个用Go语言开发的本地提醒功能,可以通过命令行参数传入消息,然后调用系统通知接口弹出系统消息。
|
- 🚀 轻量级,无第三方依赖
|
||||||
|
- 🌐 跨平台支持(Windows、macOS、Linux)
|
||||||
|
- 📝 简单易用的命令行接口
|
||||||
|
- 🔧 支持自定义通知标题和内容
|
||||||
|
|
||||||
## 支持平台
|
## 系统要求
|
||||||
|
|
||||||
- Windows
|
- Go 1.21 或更高版本
|
||||||
- macOS
|
|
||||||
- Linux
|
|
||||||
|
|
||||||
## 安装和运行
|
## 安装
|
||||||
|
|
||||||
### 前提条件
|
### 从源码编译
|
||||||
|
|
||||||
需要安装Go语言环境(1.21或更高版本)
|
|
||||||
|
|
||||||
### 编译运行
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 直接运行
|
git clone http://47.107.61.133:3000/lirh/system-toast.git
|
||||||
go run main.go -message "你的提醒消息" -title "提醒标题"
|
cd system-toast
|
||||||
|
go build -o system-toast main.go
|
||||||
# 编译为可执行文件
|
|
||||||
go build -o location-notice main.go
|
|
||||||
|
|
||||||
# 运行编译后的程序
|
|
||||||
./location-notice -message "你的提醒消息" -title "提醒标题"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 使用预编译二进制文件
|
||||||
|
|
||||||
|
从项目的 [Releases](http://47.107.61.133:3000/lirh/system-toast/releases) 页面下载适合您系统的预编译二进制文件。
|
||||||
|
|
||||||
## 使用方法
|
## 使用方法
|
||||||
|
|
||||||
### 基本用法
|
### 基本用法
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go run main.go -message "该喝水了!"
|
# 发送简单通知
|
||||||
```
|
./system-toast -message "该喝水了!"
|
||||||
|
|
||||||
### 指定标题
|
# 发送带标题的通知
|
||||||
|
./system-toast -message "会议时间到了" -title "工作提醒"
|
||||||
```bash
|
|
||||||
go run main.go -message "会议时间到了" -title "工作提醒"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 参数说明
|
### 参数说明
|
||||||
|
|
||||||
- `-message`: 通知消息内容(必需)
|
| 参数 | 类型 | 必需 | 默认值 | 说明 |
|
||||||
- `-title`: 通知标题(可选,默认为"提醒")
|
|------|------|------|--------|------|
|
||||||
|
| `-message` | 字符串 | 是 | - | 通知消息内容 |
|
||||||
|
| `-title` | 字符串 | 否 | "提醒" | 通知标题 |
|
||||||
|
|
||||||
## 示例
|
### 使用示例
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 健康提醒
|
# 健康提醒
|
||||||
go run main.go -message "站起来活动一下,保护你的腰部" -title "健康提醒"
|
./system-toast -message "站起来活动一下,保护你的腰部" -title "健康提醒"
|
||||||
|
|
||||||
# 工作提醒
|
# 工作提醒
|
||||||
go run main.go -message "15分钟后有重要会议" -title "会议提醒"
|
./system-toast -message "15分钟后有重要会议" -title "会议提醒"
|
||||||
|
|
||||||
# 生活提醒
|
# 生活提醒
|
||||||
go run main.go -message "记得今天要交水电费" -title "生活提醒"
|
./system-toast -message "记得今天要交水电费" -title "生活提醒"
|
||||||
```
|
```
|
||||||
|
|
||||||
## 技术实现
|
## 技术实现
|
||||||
|
|
||||||
- 使用Go标准库的`flag`包解析命令行参数
|
本项目根据不同操作系统调用相应的系统通知API:
|
||||||
- 根据不同操作系统调用相应的系统通知命令:
|
|
||||||
- Windows: 使用PowerShell的Toast通知
|
- **Windows**: 使用PowerShell的Toast通知
|
||||||
- macOS: 使用osascript调用系统通知
|
- **macOS**: 通过osascript调用系统通知
|
||||||
- Linux: 使用notify-send命令
|
- **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来改进这个项目!
|
||||||
Loading…
Reference in New Issue