Write a plugin
This adds a Describe command to the GCE instances list. It runs
gcloud compute instances describe against the selected instance.
-
Find where nuvem looks for the plugin file:
Shell nuvem infoThe
plugins:line names the path, for example~/..config/ (not found)nuvem/ plugins.toml -
Create that file with one plugin:
TOML version = 1[[plugins]]id = "describe"scope = "compute"key = "d"label = "Describe {name}"args = ["compute", "instances", "describe", "{name}", "--zone", "{zone}"]scopenames the service.{name}and{zone}are filled from the selected row. Plugin file reference lists every field and the template fields each service has. -
Make sure that other users cannot write it. Use the path from step 1. On Linux, unless you set
XDG_CONFIG_HOME, that is:Shell chmod o-w ~/.config/nuvem/plugins.tomlOn macOS:
Shell chmod o-w ~/Library/Application\ Support/nuvem/plugins.toml -
Run
nuvem infoagain. The line now reads(1 loaded). If it reads(0 loaded), the warning below it says what is wrong. -
Start nuvem, open GCE instances (
g, then pick the service), and select an instance. Then either:- Press
,and thend. - Press
:, typedescribe, and pressEnter.
- Press
-
nuvem shows the exact command, for example:
Text gcloud --configuration dev compute instances describe web-01 --zone europe-west1-bPress
Enterto run it orEscto cancel. -
To read what it printed, press
:and choose Plugin output. See Plugin output.
The run appears in Home’s Recent operations list. To stop a run that does not
end, press Ctrl-x.
Ask for a value
Section titled “Ask for a value”To ask for a value the row does not have, add an input. This resizes a disk to a size you type:
[[plugins]]id = "grow-disk"scope = "disks"key = "G"label = "Grow {name} to {new_size}GB"args = ["compute", "disks", "resize", "{name}", "--size", "{new_size}"]
[[plugins.inputs]]name = "new_size"type = "integer"default = 200See Typed inputs.
Mark a plugin as dangerous
Section titled “Mark a plugin as dangerous”Add dangerous = true to a plugin that deletes or changes something you
cannot undo. Its confirmation then asks you to type 1 before Enter runs it.
The 1 is the number of resources the command acts on, which for a plugin is
always one.
Changes need a restart
Section titled “Changes need a restart”nuvem reads the plugin file once, at startup. After editing it, quit and start nuvem again.
nuvem is released under the MIT License. The source is on GitHub.
nuvem is an independent project, not affiliated with or endorsed by Google. Google Cloud is a trademark of Google LLC.