-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add generated CLI help output to repo (#46)
Generate the help pages using `cobras` builtin functionality and commit them to the repository. This gives users to ability to review the options of `hcloud-upload-image` without having to install it first.
- Loading branch information
Showing
11 changed files
with
188 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## hcloud-upload-image | ||
|
||
Manage custom OS images on Hetzner Cloud. | ||
|
||
### Synopsis | ||
|
||
Manage custom OS images on Hetzner Cloud. | ||
|
||
### Options | ||
|
||
``` | ||
-h, --help help for hcloud-upload-image | ||
-v, --verbose count verbose debug output, can be specified up to 2 times | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [hcloud-upload-image cleanup](hcloud-upload-image_cleanup.md) - Remove any temporary resources that were left over | ||
* [hcloud-upload-image upload](hcloud-upload-image_upload.md) - Upload the specified disk image into your Hetzner Cloud project. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
## hcloud-upload-image cleanup | ||
|
||
Remove any temporary resources that were left over | ||
|
||
### Synopsis | ||
|
||
If the upload fails at any point, there might still exist a server or | ||
ssh key in your Hetzner Cloud project. This command cleans up any resources | ||
that match the label "apricote.de/created-by=hcloud-upload-image". | ||
|
||
If you want to see a preview of what would be removed, you can use the official hcloud CLI and run: | ||
|
||
$ hcloud server list -l apricote.de/created-by=hcloud-upload-image | ||
$ hcloud ssh-key list -l apricote.de/created-by=hcloud-upload-image | ||
|
||
This command does not handle any parallel executions of hcloud-upload-image | ||
and will remove in-use resources if called at the same time. | ||
|
||
``` | ||
hcloud-upload-image cleanup [flags] | ||
``` | ||
|
||
### Options | ||
|
||
``` | ||
-h, --help help for cleanup | ||
``` | ||
|
||
### Options inherited from parent commands | ||
|
||
``` | ||
-v, --verbose count verbose debug output, can be specified up to 2 times | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [hcloud-upload-image](hcloud-upload-image.md) - Manage custom OS images on Hetzner Cloud. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## hcloud-upload-image upload | ||
|
||
Upload the specified disk image into your Hetzner Cloud project. | ||
|
||
### Synopsis | ||
|
||
This command implements a fake "upload", by going through a real server and snapshots. | ||
This does cost a bit of money for the server. | ||
|
||
``` | ||
hcloud-upload-image upload (--image-path=<local-path> | --image-url=<url>) --architecture=<x86|arm> [flags] | ||
``` | ||
|
||
### Examples | ||
|
||
``` | ||
hcloud-upload-image upload --image-path /home/you/images/custom-linux-image-x86.bz2 --architecture x86 --compression bz2 --description "My super duper custom linux" | ||
hcloud-upload-image upload --image-url https://examples.com/image-arm.raw --architecture arm --labels foo=bar,version=latest | ||
``` | ||
|
||
### Options | ||
|
||
``` | ||
--architecture string CPU architecture of the disk image [choices: x86, arm] | ||
--compression string Type of compression that was used on the disk image [choices: bz2, xz] | ||
--description string Description for the resulting image | ||
-h, --help help for upload | ||
--image-path string Local path to the disk image that should be uploaded | ||
--image-url string Remote URL of the disk image that should be uploaded | ||
--labels stringToString Labels for the resulting image (default []) | ||
--server-type string Explicitly use this server type to generate the image. Mutually exclusive with --architecture. | ||
``` | ||
|
||
### Options inherited from parent commands | ||
|
||
``` | ||
-v, --verbose count verbose debug output, can be specified up to 2 times | ||
``` | ||
|
||
### SEE ALSO | ||
|
||
* [hcloud-upload-image](hcloud-upload-image.md) - Manage custom OS images on Hetzner Cloud. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/spf13/cobra/doc" | ||
|
||
"github.com/apricote/hcloud-upload-image/cmd" | ||
) | ||
|
||
func run() error { | ||
// Define the directory where the docs will be generated | ||
dir := "docs/cli" | ||
|
||
// Ensure the directory exists | ||
if err := os.MkdirAll(dir, 0755); err != nil { | ||
return fmt.Errorf("error creating docs directory: %v", err) | ||
} | ||
|
||
// Generate the docs | ||
if err := doc.GenMarkdownTree(cmd.RootCmd, dir); err != nil { | ||
return fmt.Errorf("error generating docs: %v", err) | ||
} | ||
|
||
fmt.Println("Docs generated successfully in", dir) | ||
return nil | ||
} | ||
|
||
func main() { | ||
if err := run(); err != nil { | ||
fmt.Printf("Error: %v\n", err) | ||
os.Exit(1) | ||
} | ||
} |