@@ -15,11 +15,47 @@ import (
1515 "github.com/deployKF/cli/internal/version"
1616)
1717
18- const generateHelp = `
19- XXXXXXXXXX
20- XXXXXXXXXX
21- XXXXXXXXXX
22- XXXXXXXXXX
18+ const generateHelp = `This command will generate an output folder containing Kubernetes manifests.
19+
20+ ARGUMENTS:
21+ ----------------
22+
23+ You must provide either '--source-version' OR '--source-path' to specify the source of the generator:
24+ - If '--source-version' is provided, the provided version tag will be downloaded from the 'deployKF/deployKF' GitHub.
25+ - If '--source-path' is provided, the source will be read from the provided local directory or '.zip' file.
26+
27+ You may provide one or more '--values' files that contain your configuration values:
28+ - For more information on how to structure your values files, see the 'deployKF/deployKF' GitHub repository.
29+
30+ You must provide '--output-dir' to specify the output directory for the generated manifests:
31+ - If the directory does not exist, it will be created.
32+ - If the directory is non-empty, it will be cleaned before generating the manifests.
33+ However, it must contain a '.deploykf_output' marker file, otherwise the command will fail.
34+
35+ OUTPUT:
36+ ----------------
37+
38+ The '.deploykf_output' marker file contains the following information:
39+ - generated_at: the time the generator was run
40+ - source_version: the source version that was used (if '--source-version' was provided)
41+ - source_path: the path of the source artifact that was used
42+ - source_hash: the SHA256 hash of the source artifact that was used
43+ - cli_version: the version of the deployKF CLI that was used
44+
45+ EXAMPLES:
46+ ----------------
47+
48+ To generate manifests from a GitHub source version:
49+
50+ $ deploykf generate --source-version v0.1.0 --values ./values.yaml --output-dir ./GENERATOR_OUTPUT
51+
52+ To generate manifests from a local source zip file:
53+
54+ $ deploykf generate --source-path ./deploykf.zip --values ./values.yaml --output-dir ./GENERATOR_OUTPUT
55+
56+ To generate manifests from a local source directory:
57+
58+ $ deploykf generate --source-path ./deploykf --values ./values.yaml --output-dir ./GENERATOR_OUTPUT
2359`
2460
2561type generateOptions struct {
@@ -34,18 +70,18 @@ func newGenerateCmd(out io.Writer) *cobra.Command {
3470
3571 var cmd = & cobra.Command {
3672 Use : "generate" ,
37- Short : "XXXXXXXXXX " ,
73+ Short : "Generate Kubernetes manifests from deployKF templates and config values " ,
3874 Long : generateHelp ,
3975 RunE : func (cmd * cobra.Command , args []string ) error {
4076 return o .run (out )
4177 },
4278 }
4379
4480 // add local flags
45- cmd .Flags ().StringVarP (& o .sourceVersion , "source-version" , "V" , "" , "XXXXXXX " )
46- cmd .Flags ().StringVar (& o .sourcePath , "source-path" , "" , "" )
47- cmd .Flags ().StringSliceVarP (& o .values , "values" , "f" , []string {}, "XXXXXXX " )
48- cmd .Flags ().StringVarP (& o .outputDir , "output-dir" , "O" , "" , "XXXXXXX " )
81+ cmd .Flags ().StringVarP (& o .sourceVersion , "source-version" , "V" , "" , "a version tag from the 'deployKF/deployKF' GitHub repository " )
82+ cmd .Flags ().StringVar (& o .sourcePath , "source-path" , "" , "a local path to a directory or '.zip' file containing a generator source " )
83+ cmd .Flags ().StringSliceVarP (& o .values , "values" , "f" , []string {}, "a YAML file containing configuration values " )
84+ cmd .Flags ().StringVarP (& o .outputDir , "output-dir" , "O" , "" , "the output directory in which to generate the manifests " )
4985
5086 // mark local flags
5187 cmd .MarkFlagsMutuallyExclusive ("source-version" , "source-path" )
@@ -56,13 +92,11 @@ func newGenerateCmd(out io.Writer) *cobra.Command {
5692
5793func (o * generateOptions ) run (out io.Writer ) error {
5894 // TODO: verify the provided `--values`:
59- // - ensure we test with multiple provided values files (also try with none)
60- // - check the YAML schema against a spec that is defined in the generator
61- // - check that all listed files exist
62- // - consider more complex verification, like mutually-exclusive fields, etc.
95+ // - check the YAML schema against a spec that is defined in the generator source
96+ // - check that all provided file paths exist (before gomplate fails)
6397
6498 // initialise the source helper
65- // TODO: let users provide their own repo/owner
99+ // TODO: let users provide their own repo/owner for the source
66100 sourceHelper := generate .NewSourceHelper ()
67101
68102 // create a temporary directory to store our generator source,
0 commit comments