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.5),升级命令:

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.5.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.5-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: goosehost_cli-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 5ac9656af46c36229778acaa8d33ba956c9e880a66f3342d159229ce383f7760
MD5 18c4e01203de6408a1999710d130c5b2
BLAKE2b-256 ffd5b7f459371f750f61ec2d0362e4adc093406c28d5e31731604c7d40612aac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: goosehost_cli-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8d551489bdd1d176834560c1161b2c5344dcbf79cfa0bcc9d9195c33931e33f2
MD5 0bf5b34fe546452524612320a21e1881
BLAKE2b-256 55d442747281226cf472480963aab3c7e9642a6140471b4e47549f30317fd2d7

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