Skip to content

Commit 5660624

Browse files
committed
fix: some nits
1 parent 0d4c4ab commit 5660624

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

pkg/cli/alpha/generate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2022 The Kubernetes Authors.
2+
Copyright 2023 The Kubernetes Authors.
33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.
55
You may obtain a copy of the License at
@@ -25,7 +25,7 @@ func NewScaffoldCommand() *cobra.Command {
2525
opts := rescaffold.MigrateOptions{}
2626
scaffoldCmd := &cobra.Command{
2727
Use: "generate",
28-
Short: "Re-scaffold an existing kuberbuilder project",
28+
Short: "Re-scaffold an existing Kuberbuilder project",
2929
Long: `It's an experimental feature that has the purpose of re-scaffolding the whole project from the scratch using the current version of KubeBuilder binary available.
3030
# make sure the PROJECT file is in the 'input-dir' argument, the default is the current directory.
3131
$ kubebuilder alpha generate --input-dir="./test" --output-dir="./my-output"
@@ -41,7 +41,7 @@ Then we will re-scaffold the project by Kubebuilder in the directory specified b
4141
},
4242
}
4343
scaffoldCmd.Flags().StringVar(&opts.InputDir, "input-dir", "",
44-
"path to a kubebuilder project file if not in the current working directory")
44+
"path to a Kubebuilder project file if not in the current working directory")
4545
scaffoldCmd.Flags().StringVar(&opts.OutputDir, "output-dir", rescaffold.DefaultOutputDir,
4646
"path to output the scaffolding. defaults a directory in the current working directory")
4747

pkg/rescaffold/migrate.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2022 The Kubernetes Authors.
2+
Copyright 2023 The Kubernetes Authors.
33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.
55
You may obtain a copy of the License at
@@ -34,8 +34,8 @@ type MigrateOptions struct {
3434
const DefaultOutputDir = "output-dir"
3535

3636
func (opts *MigrateOptions) Rescaffold() error {
37-
store := yaml.New(machinery.Filesystem{FS: afero.NewOsFs()})
38-
if err := store.LoadFrom(opts.InputDir); err != nil {
37+
config := yaml.New(machinery.Filesystem{FS: afero.NewOsFs()})
38+
if err := config.LoadFrom(opts.InputDir); err != nil {
3939
log.Fatal(err)
4040
os.Exit(1)
4141
}
@@ -49,7 +49,7 @@ func (opts *MigrateOptions) Rescaffold() error {
4949
log.Fatal(err)
5050
}
5151
// init project with plugins
52-
if err := kubebuilderInit(store); err != nil {
52+
if err := kubebuilderInit(config); err != nil {
5353
log.Fatal(err)
5454
}
5555
return nil
@@ -74,9 +74,9 @@ func (opts *MigrateOptions) Validate() error {
7474
return err
7575
}
7676

77-
func getInputPath(cwd string, inputPath string) (string, error) {
77+
func getInputPath(currentWorkingDirectory string, inputPath string) (string, error) {
7878
if inputPath == "" {
79-
inputPath = cwd
79+
inputPath = currentWorkingDirectory
8080
}
8181
projectPath := fmt.Sprintf("%s/%s", inputPath, yaml.DefaultPath)
8282
if _, err := os.Stat(projectPath); os.IsNotExist(err) {
@@ -85,9 +85,9 @@ func getInputPath(cwd string, inputPath string) (string, error) {
8585
return projectPath, nil
8686
}
8787

88-
func getOutputPath(cwd, outputPath string) string {
88+
func getOutputPath(currentWorkingDirectory , outputPath string) string {
8989
if outputPath == DefaultOutputDir {
90-
outputPath = fmt.Sprintf("%s/%s", cwd, outputPath)
90+
outputPath = fmt.Sprintf("%s/%s", currentWorkingDirectory , outputPath)
9191
}
9292
return outputPath
9393
}

0 commit comments

Comments
 (0)