Skip to content

Commit

Permalink
Merge branch 'main' into feat/#54-suppport-spec-associatedresources
Browse files Browse the repository at this point in the history
  • Loading branch information
nesmabadr authored Oct 24, 2024
2 parents b5c34df + 2460d85 commit bcaf92e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
5 changes: 4 additions & 1 deletion cmd/modulectl/scaffold/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func Test_Execute_ParsesOptions(t *testing.T) {
os.Args = []string{
"scaffold",
"--directory", directory,
"--module-config", moduleConfigFile,
"--config-file", moduleConfigFile,
"--overwrite",
"--gen-manifest", manifestFile,
"--gen-default-cr=" + defaultCRFile,
Expand Down Expand Up @@ -84,8 +84,10 @@ func Test_Execute_ParsesOptions(t *testing.T) {

func Test_Execute_ParsesShortOptions(t *testing.T) {
directory := testutils.RandomName(10)
configFile := testutils.RandomName(10)
os.Args = []string{
"scaffold",
"-c", configFile,
"-d", directory,
"-o",
}
Expand All @@ -95,6 +97,7 @@ func Test_Execute_ParsesShortOptions(t *testing.T) {
err := cmd.Execute()
require.NoError(t, err)

assert.Equal(t, configFile, svc.opts.ModuleConfigFileName)
assert.Equal(t, directory, svc.opts.Directory)
assert.True(t, svc.opts.ModuleConfigFileOverwrite)
}
Expand Down
5 changes: 3 additions & 2 deletions cmd/modulectl/scaffold/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const (
DirectoryFlagDefault = "./"
directoryFlagUsage = `Specifies the target directory where the scaffolding shall be generated (default "./").`

ModuleConfigFileFlagName = "module-config"
ModuleConfigFileFlagName = "config-file"
moduleConfigFileFlagShort = "c"
ModuleConfigFileFlagDefault = "scaffold-module-config.yaml"
moduleConfigFileFlagUsage = `Specifies the name of the generated module configuration file (default "scaffold-module-config.yaml").`

Expand Down Expand Up @@ -50,7 +51,7 @@ const (

func parseFlags(flags *pflag.FlagSet, opts *scaffold.Options) {
flags.StringVarP(&opts.Directory, DirectoryFlagName, directoryFlagShort, DirectoryFlagDefault, directoryFlagUsage)
flags.StringVar(&opts.ModuleConfigFileName, ModuleConfigFileFlagName, ModuleConfigFileFlagDefault, moduleConfigFileFlagUsage)
flags.StringVarP(&opts.ModuleConfigFileName, ModuleConfigFileFlagName, moduleConfigFileFlagShort, ModuleConfigFileFlagDefault, moduleConfigFileFlagUsage)
flags.BoolVarP(&opts.ModuleConfigFileOverwrite, ModuleConfigFileOverwriteFlagName, moduleConfigFileOverwriteFlagShort, ModuleConfigFileOverwriteFlagDefault, moduleConfigFileOverwriteFlagUsage)
flags.StringVar(&opts.ManifestFileName, ManifestFileFlagName, ManifestFileFlagDefault, manifestFileFlagUsage)
flags.StringVar(&opts.DefaultCRFileName, DefaultCRFlagName, DefaultCRFlagDefault, defaultCRFlagUsage)
Expand Down
2 changes: 1 addition & 1 deletion cmd/modulectl/scaffold/long.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ allowing for a tailored scaffolding experience according to the specific needs o
The command generates or uses the following files:
- Module Config:
Enabled: Always
Adjustable with flag: --module-config=VALUE
Adjustable with flag: --config-file=VALUE
Generated when: The file doesn't exist or the --overwrite=true flag is provided
Default file name: scaffold-module-config.yaml
- Manifest:
Expand Down
4 changes: 2 additions & 2 deletions docs/gen-docs/modulectl_scaffold.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ allowing for a tailored scaffolding experience according to the specific needs o
The command generates or uses the following files:
- Module Config:
Enabled: Always
Adjustable with flag: --module-config=VALUE
Adjustable with flag: --config-file=VALUE
Generated when: The file doesn't exist or the --overwrite=true flag is provided
Default file name: scaffold-module-config.yaml
- Manifest:
Expand Down Expand Up @@ -69,13 +69,13 @@ Generate a scaffold with a manifest file, default CR and security-scanners confi
## Flags

```bash
-c, --config-file string Specifies the name of the generated module configuration file (default "scaffold-module-config.yaml").
-d, --directory string Specifies the target directory where the scaffolding shall be generated (default "./").
--gen-default-cr string Specifies the default CR in the generated module config. A blank default CR file is generated if it doesn't exist (default "default-cr.yaml").
--gen-manifest string Specifies the manifest in the generated module config. A blank manifest file is generated if it doesn't exist (default "manifest.yaml").
--gen-security-config string Specifies the security file in the generated module config. A scaffold security config file is generated if it doesn't exist (default "sec-scanners-config.yaml").
-h, --help Provides help for the scaffold command.
--module-channel string Specifies the module channel in the generated module config file (default "regular").
--module-config string Specifies the name of the generated module configuration file (default "scaffold-module-config.yaml").
--module-name string Specifies the module name in the generated config file (default "kyma-project.io/module/mymodule").
--module-version string Specifies the module version in the generated module config file (default "0.0.1").
-o, --overwrite Specifies if the command overwrites an existing module configuration file.
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/scaffold/scaffold_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (cmd *scaffoldCmd) execute() error {
}

if cmd.moduleConfigFileFlag != "" {
args = append(args, "--module-config="+cmd.moduleConfigFileFlag)
args = append(args, "--config-file="+cmd.moduleConfigFileFlag)
}

if cmd.genDefaultCRFlag != "" {
Expand Down

0 comments on commit bcaf92e

Please sign in to comment.