-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Added --output-folder flag to scaffold #3805
Added --output-folder flag to scaffold #3805
Conversation
cli/commands/scaffold/action.go
Outdated
// scaffold only in empty directories | ||
if empty, err := util.IsDirectoryEmpty(opts.WorkingDir); !empty || err != nil { | ||
if err != nil { | ||
return err | ||
} | ||
|
||
opts.Logger.Warnf("The working directory %s is not empty.", opts.WorkingDir) | ||
opts.Logger.Warnf("The woring directory %s is not empty.", opts.WorkingDir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an accidental typo here ^
I'm going to avoid merging this in for now, as we have a lot of other CLI Redesign work in-flight, but it looks good to me. Will merge this in if we don't get those changes to the CLI merged in relatively soon. |
Hey @KabaevRoman ! We've recently done a lot of work on the CLI Redesign, and that's caused some conflicts here. Are you willing to rebase your work? |
@yhakbar, got it i'll try to update it with fixes and conflict resolution tomorrow |
631b035
to
a9bd4da
Compare
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis pull request introduces a new flag and related functionality to allow users to specify an output directory for the scaffolded files. The changes update logging messages, the configuration object, and the boilerplate options to use an output folder derived from the new flag. Documentation and tests have been updated to mirror these modifications, ensuring the new functionality integrates with the existing scaffolding workflow without altering error handling or core logic. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant CLI as Terragrunt CLI
participant Action as Scaffold Action
participant Logger as Logger
U->>CLI: Run "terragrunt scaffold" with --output-folder
CLI->>Action: Pass options with ScaffoldOutputFolder value
Action->>Action: Determine outputDir (flag value or default WorkingDir)
Action->>Logger: Log scaffolding messages using outputDir
Logger-->>U: Display status messages
Assessment against linked issues
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
cli/commands/scaffold/action.go (1)
124-131
:⚠️ Potential issueDirectory check should be performed on the output directory.
The empty directory check is currently performed on
opts.WorkingDir
, but it should be checkingoutputDir
since that's where the files will be created.Apply this diff to fix the issue:
-if empty, err := util.IsDirectoryEmpty(opts.WorkingDir); !empty || err != nil { +if empty, err := util.IsDirectoryEmpty(outputDir); !empty || err != nil { if err != nil { return err } - opts.Logger.Warnf("The working directory %s is not empty.", opts.WorkingDir) + opts.Logger.Warnf("The output directory %s is not empty.", outputDir) }
🧹 Nitpick comments (1)
docs/_docs/02_features/05-catalog.md (1)
55-55
: Let's polish the flag documentation.The description is good but could be even clearer with a few tweaks.
Here's a suggested improvement:
-- `--output-folder` - Location for generated `terragrunt.hcl`. If flag is not provided current working directory is selected. +- `--output-folder` - Specifies the location for the generated `terragrunt.hcl` file. If this flag is not provided, the current working directory will be used.🧰 Tools
🪛 LanguageTool
[uncategorized] ~55-~55: You might be missing the article “a” here.
Context: ...tion for generatedterragrunt.hcl
. If flag is not provided current working directo...(AI_EN_LECTOR_MISSING_DETERMINER_A)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
cli/commands/scaffold/action.go
(4 hunks)cli/commands/scaffold/command.go
(2 hunks)docs/_docs/02_features/05-catalog.md
(2 hunks)options/options.go
(1 hunks)test/integration_scaffold_test.go
(1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/_docs/02_features/05-catalog.md
[uncategorized] ~55-~55: You might be missing the article “a” here.
Context: ...tion for generated terragrunt.hcl
. If flag is not provided current working directo...
(AI_EN_LECTOR_MISSING_DETERMINER_A)
🔇 Additional comments (4)
cli/commands/scaffold/command.go (1)
20-20
: LGTM! Nice addition of the output folder flag.The flag is well-integrated into the existing flags structure with a clear usage description.
Also applies to: 58-62
test/integration_scaffold_test.go (1)
193-203
: Great test coverage for the new flag!The test effectively verifies that the
--output-folder
flag works as expected by checking both successful execution and file creation in the specified directory.options/options.go (1)
314-315
: LGTM! Well-documented field addition.The new
ScaffoldOutputFolder
field is properly documented and logically grouped with other scaffold-related fields.docs/_docs/02_features/05-catalog.md (1)
19-19
: Looking good! Command signature updated correctly.The new
--output-folder
flag has been properly added to the command signature with the correct optional syntax.
@yhakbar rebased pr and fixed typo, would be nice to trigger pipelines |
Description
Added --output-folder flag for scaffold
Fixes #3652.
TODOs
Read the Gruntwork contribution guidelines.
Release Notes (draft)
Added / Removed / Updated [X].
Added --output-folder flag for scaffold
Migration Guide
Summary by CodeRabbit
New Features
--output-folder
flag for the scaffolding command, allowing users to specify a custom location for generated files (defaulting to the working directory if not set).Documentation