Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📖 improve docs of rescaffold #4479

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sijoma
Copy link
Contributor

@Sijoma Sijoma commented Jan 9, 2025

So I was irritated by reading the documentation and also the CLI --help output.

I was surprised that the output-dir actually defaults to output-dir. I also did not understand how I could use git to diff the files with upstream if they are created in a sub directory. I would understand how this works if the files would be regenerated in place.

I've adjusted the docs & command to be more explicit about the default value output-dir.
Furthermore, I've adjusted the note to explain that you can diff the local files against the output-dir (the folder that was configured by the user).

relates #4478

- name the default explicitly

relates kubernetes-sigs#4478
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 9, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Sijoma
Once this PR has been reviewed and has the lgtm label, please assign varshaprasad96 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 9, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @Sijoma. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@@ -29,7 +29,7 @@ Currently, it supports two optional params, `input-dir` and `output-dir`.

`input-dir` is the path to the existing project that you want to re-scaffold. Default is the current working directory.

`output-dir` is the path to the directory where you want to generate the new project. Default is a subdirectory in the current working directory.
`output-dir` is the path to the directory where you want to generate the new project. Default is a directory named "output-dir" in the current working directory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we not inform the output-dir it should be == $pwd , the current directory.
Are you facing a different behaviour?
Does it create a directory called output-dir and scaffold the project inside of it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that's the part that confused me.

The flag itself defaults to "" -> pkg/cli/alpha/command.go:59

The struct itself has a default then later here -> pkg/cli/alpha/internal/generate.go:46

image

It then sets it when this path is "" here as a default. -> pkg/cli/alpha/internal/generate.go:246

At least this is how I understand it and I get a output-dir folder.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OH we need to fix that.
It is a bug. By default it should be current dir == PWD

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to get this right: So instead of appending output-dir to the PWD it should be just the PWD right?

I can make a PR for this & maybe this then also removes the need to change the docs.

Copy link
Contributor Author

@Sijoma Sijoma Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So something like this?

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to do a little more than that.
Also, we need to ensure it via the tests.
See: #4500

@@ -39,7 +39,7 @@ kubebuilder alpha generate --input-dir=/path/to/existing/project --output-dir=/p
<h1>Regarding `input-dir` and `output-dir`:</h1>

If neither `input-dir` nor `output-dir` are specified, the project will be regenerated in the current directory.
This approach facilitates comparison between your current local branch and the version stored upstream (e.g., GitHub main branch).
This approach facilitates comparison between your code and regenerated files in `output-dir`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants