Skip to main content

GooseHost-静态网站托管

Project description

GooseHost CLI

在终端里管理 GooseHost 的静态网站,不需要开浏览器。


安装

pip install goosehost-cli

安装后,在终端输入 goosehost 就可以用了。


快速开始

1. 登录(只做一次)

goosehost login --email 你的邮箱 --password 你的密码

登录后凭证保存在本地,下次不用再输入。

2. 部署一个 HTML 文件

goosehost deploy ./index.html

./index.html 表示当前目录下的 index.html 文件。
工具会自动用文件名作为网站名称,并在终端显示访问地址。

3. 查看所有网站

goosehost list

完整命令列表

登录与账号

命令 说明
goosehost login --email xxx --password xxx 登录并保存凭证
goosehost logout 退出登录(清除本地凭证)
goosehost register --email xxx --password xxx 注册新账号

网站管理

命令 说明
goosehost list 列出你的所有网站
goosehost create --slug 名称 --type html --file 文件路径 从文件创建网站
goosehost create --slug 名称 --type html --content "<h1>Hi</h1>" 直接从文字创建网站
goosehost get --slug 网站名称 查看html内容
goosehost get --slug md/markdown网站名称 查看markdown内容
goosehost get --slug 网站名称 --output 保存路径 下载html内容到本地文件
goosehost get --slug md/网站名称 --output 保存路径 下载markdown内容到本地文件
goosehost update --slug 网站名称 --file 文件路径 用本地html文件更新
goosehost update --slug md/网站名称 --file 文件路径 用本地markdown文件更新
goosehost update --slug 网站名称 --content "新内容" 直接更新内容(markdown站点需加md/前缀,不建议使用此命令)
goosehost delete --slug 网站名称 --force 删除html网站(需要加 --force
goosehost delete --slug md/网站名称 --force 删除markdown网站(需要加 --force

快捷部署

命令 说明
goosehost deploy ./文件.html 部署 HTML 文件(自动起名)
goosehost deploy ./文件.md 部署 Markdown 文件(自动起名)
goosehost deploy ./文件.html --slug 自定义名称 部署并指定网站名称

其他

命令 说明
goosehost config 查看当前登录状态和配置
goosehost --help 查看所有命令的帮助

文件路径怎么写

在命令中,所有 --file--output 后面的路径都支持两种写法:

  • 相对路径:相对于当前终端所在的目录
    例如:./index.htmlbackup.html../my-site/index.html

  • 绝对路径:从磁盘根目录开始的完整路径
    例如:D:/my-site/index.htmlC:\Users\Administrator\backup.html

如果不确定当前终端在哪个目录,可以输入:

  • Windows:cd
  • Mac/Linux:pwd

常用操作示例

部署当前文件夹里的首页

goosehost deploy ./index.html

输出示例:

部署成功!
  访问地址: https://page.goose.cc.cd/s/my-site
  网站名称: my-site

直接用文字创建一个 Markdown 网站

goosehost create --slug my-doc --type md --content "# 我的文档\n\n这是内容"

把线上网站下载到本地修改

第一步:下载到当前目录

goosehost get --slug my-site --output backup.html

下载后,当前目录会多出一个 backup.html 文件。
如果你想保存到其他文件夹,可以写完整路径:

goosehost get --slug my-site --output D:/my-backup/index.html

第二步:用编辑器修改 backup.html

第三步:传回去

goosehost update --slug my-site --file backup.html

如果文件在其他路径,就填完整路径:

goosehost update --slug my-site --file D:/my-backup/index.html

查看网站内容(不保存,只显示)

goosehost get --slug my-site

终端会直接打印出网站的全部代码。

删除一个网站

goosehost delete --slug my-site --force

卸载

pip uninstall goosehost-cli

常见问题

登录后每次都要重新登录吗?

不用。凭证保存在本地,下次打开终端会自动生效。

安装后输入 goosehost 提示找不到命令?

重启终端。如果还不行,检查 Python 的 Scripts 目录是否在系统 PATH 里。

部署后访问地址不对(显示 goose.cc.cd 而不是 page.goose.cc.cd)?

确保你安装的是最新版本(>= 0.1.3),升级命令:

pip install --upgrade goosehost-cli

pip install goosehost-cli 安装的不是最新版?

国内镜像可能有延迟,临时从官方源安装:

pip install -i https://pypi.org/simple goosehost-cli

--output 不填会怎样?

内容会直接打印在终端,不会保存成文件。

为什么删除网站必须加 --force

防止手滑误删。确认你真的要删,再加 --force


更多帮助

查看所有命令:

goosehost --help

查看某个命令的详细用法,例如:

goosehost create --help

Enjoy your static sites! 🚀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

goosehost_cli-0.1.4.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

goosehost_cli-0.1.4-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file goosehost_cli-0.1.4.tar.gz.

File metadata

  • Download URL: goosehost_cli-0.1.4.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for goosehost_cli-0.1.4.tar.gz
Algorithm Hash digest
SHA256 7bfc8ec8eea07815817ebbf5d6b6f7e1e4e4363c8f9385f04fa1963cc6eb990a
MD5 2c61fca391e8bde55ded049470d60d68
BLAKE2b-256 ad388d95270f64e61add7e940132b1a8a5bf46f07a9a664ac0157420cd67ed01

See more details on using hashes here.

File details

Details for the file goosehost_cli-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: goosehost_cli-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for goosehost_cli-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a83c6f7fd7aacb525090a32f776cf6911562301c7181b928da9bc440f0957419
MD5 a1fb22bce85b38a11774dd2ee6fde9a3
BLAKE2b-256 189370cbccd9b1836abff55d5dfbcca4b509595d1e80deb002886304626b7beb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page