#gcloud #projects #gcp #switch #cli-tool #refresh #google

app gsp

简单的 CLI 工具,用于在 gcloud 项目之间切换

5 个版本

0.1.5 2024 年 6 月 20 日
0.1.4 2023 年 11 月 7 日
0.1.3 2023 年 7 月 3 日
0.1.2 2023 年 3 月 7 日
0.1.0 2023 年 3 月 6 日

#459 in 命令行工具

MIT 许可证

20KB
275

gsp

A CLI tool to easily switch between Google gcloud projects inspired by the late gsp.

This is more a pretext to play with Rust than anything else but I use this tool a lot and I will continue to maintain it.

用法

 gsp help
Simple CLI to switch between gcloud projects.


Usage: gsp [OPTIONS] [PROJECT] [COMMAND]

Commands:
  current               Print the project which currently used
  list                  List the available projects
  refresh               Refresh the list of available projects
  generate-completions  Generate shell completions
  help                  Print this message or the help of the given subcommand(s)

Arguments:
  [PROJECT]  Part or entire project ID

Options:
      --log-level <LOG_LEVEL>  Set the log level [default: INFO] [possible values: TRACE, DEBUG, INFO, WARN, ERROR]
      --refresh                Force a cache refresh then run the requested command
  -h, --help                   Print help
  -V, --version                Print version

缓存

为了避免每次都刷新项目列表,将创建一个缓存文件。该文件存储在 ~/.cache/gsp/projects.json

缓存包含可用的项目列表,可以通过使用 gsp refresh 命令或向任何其他命令添加 --refresh 参数来刷新。

 gsp list --refresh
[INFO] The cache was successfully refreshed.
+----------------------------------+----------------+--------------------------------+
| Project ID                       | Project number | Project name                   |
+==================================+================+================================+
| dummy-example-project            | 902838561285   | Example Project                |
+----------------------------------+----------------+--------------------------------+

生成完成

gsp generate-completions --shell zsh > ${ZSH}/completions/_gsp

依赖项

~13–23MB
~314K SLoC