From 95cc640f2cd6a502f64a21c90c0a2e50c23980b9 Mon Sep 17 00:00:00 2001 From: lroyia Date: Fri, 5 Dec 2025 10:10:12 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E9=87=8D=E5=86=99README=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新项目名称为System Toast - 添加特性列表和系统要求说明 - 优化安装和使用说明,增加参数表格 - 添加项目结构和开发说明 - 改进格式和可读性 --- README.md | 105 ++++++++++++++++++++++++++++++++++-------------------- go.mod | 2 +- 2 files changed, 67 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 6a33d3b..6bb5bc4 100644 --- a/README.md +++ b/README.md @@ -1,72 +1,99 @@ -# location-notice +# System Toast -本地提醒小程序 +一个轻量级的跨平台系统通知工具,使用Go语言开发,可以通过命令行发送系统通知。 -## 功能介绍 +## 特性 -这是一个用Go语言开发的本地提醒功能,可以通过命令行参数传入消息,然后调用系统通知接口弹出系统消息。 +- 🚀 轻量级,无第三方依赖 +- 🌐 跨平台支持(Windows、macOS、Linux) +- 📝 简单易用的命令行接口 +- 🔧 支持自定义通知标题和内容 -## 支持平台 +## 系统要求 -- Windows -- macOS -- Linux +- Go 1.21 或更高版本 -## 安装和运行 +## 安装 -### 前提条件 - -需要安装Go语言环境(1.21或更高版本) - -### 编译运行 +### 从源码编译 ```bash -# 直接运行 -go run main.go -message "你的提醒消息" -title "提醒标题" - -# 编译为可执行文件 -go build -o location-notice main.go - -# 运行编译后的程序 -./location-notice -message "你的提醒消息" -title "提醒标题" +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 -go run main.go -message "该喝水了!" -``` +# 发送简单通知 +./system-toast -message "该喝水了!" -### 指定标题 - -```bash -go run main.go -message "会议时间到了" -title "工作提醒" +# 发送带标题的通知 +./system-toast -message "会议时间到了" -title "工作提醒" ``` ### 参数说明 -- `-message`: 通知消息内容(必需) -- `-title`: 通知标题(可选,默认为"提醒") +| 参数 | 类型 | 必需 | 默认值 | 说明 | +|------|------|------|--------|------| +| `-message` | 字符串 | 是 | - | 通知消息内容 | +| `-title` | 字符串 | 否 | "提醒" | 通知标题 | -## 示例 +### 使用示例 ```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`包解析命令行参数 -- 根据不同操作系统调用相应的系统通知命令: - - Windows: 使用PowerShell的Toast通知 - - macOS: 使用osascript调用系统通知 - - Linux: 使用notify-send命令 \ No newline at end of file +本项目根据不同操作系统调用相应的系统通知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来改进这个项目! \ No newline at end of file diff --git a/go.mod b/go.mod index c41bcb1..6d75a33 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module location-notice -go 1.21 \ No newline at end of file +go 1.21