github-gist
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGitHub Gist Publisher
GitHub Gist 发布工具
Publish any file as a GitHub Gist for easy sharing.
将任意文件发布为GitHub Gist,便于分享。
Prerequisites
前置条件
Uses CLI by default. Ensure you're authenticated:
ghbash
gh auth status默认使用 CLI工具。请确保已完成身份验证:
ghbash
gh auth statusIf not authenticated: gh auth login
如果未验证:gh auth login
Fallback: Set `GITHUB_GIST_TOKEN` env var with gist scope.
备选方案:设置带有gist权限的`GITHUB_GIST_TOKEN`环境变量。Usage
使用方法
bash
undefinedbash
undefinedPublish file as secret (unlisted) gist - DEFAULT
将文件发布为私密(未列出)Gist - 默认设置
python3 scripts/publish_gist.py /path/to/file.md
python3 scripts/publish_gist.py /path/to/file.md
Publish as public gist (visible in your profile)
将文件发布为公开Gist(会显示在你的个人主页中)
python3 scripts/publish_gist.py /path/to/file.md --public
python3 scripts/publish_gist.py /path/to/file.md --public
Custom description
自定义描述
python3 scripts/publish_gist.py /path/to/file.md -d "My awesome note"
python3 scripts/publish_gist.py /path/to/file.md -d "我的精彩笔记"
Override filename in gist
覆盖Gist中的文件名
python3 scripts/publish_gist.py /path/to/file.md -f "readme.md"
python3 scripts/publish_gist.py /path/to/file.md -f "readme.md"
From stdin
从标准输入读取内容
echo "Hello" | python3 scripts/publish_gist.py - -f "hello.txt"
echo "Hello" | python3 scripts/publish_gist.py - -f "hello.txt"
Just get URL
仅获取链接
python3 scripts/publish_gist.py /path/to/file.md --url-only
python3 scripts/publish_gist.py /path/to/file.md --url-only
Create and open in browser
创建后在浏览器中打开
python3 scripts/publish_gist.py /path/to/file.md --open
undefinedpython3 scripts/publish_gist.py /path/to/file.md --open
undefinedOptions
可选参数
| Flag | Description |
|---|---|
| Create public gist (default is secret/unlisted) |
| Gist description |
| Override filename |
| Output only URL |
| Open in browser |
| Force API instead of gh CLI |
| 标识 | 描述 |
|---|---|
| 创建公开Gist(默认是私密/未列出) |
| Gist描述 |
| 覆盖文件名 |
| 仅输出链接 |
| 在浏览器中打开 |
| 强制使用API而非gh CLI |
Output
输出示例
json
{
"url": "https://gist.github.com/user/abc123",
"id": "abc123",
"public": false,
"filename": "file.md"
}json
{
"url": "https://gist.github.com/user/abc123",
"id": "abc123",
"public": false,
"filename": "file.md"
}Example
示例
Session log published with this skill: https://gist.github.com/glebis/3faaae6b907123929220e81add51a567