Repository navigation
docs(init): clarify --force behaviour in help and documentation - #2971
Merged
lengau merged 4 commits intoOct 23, 2026
Merged
Conversation
lengau
marked this pull request as draft
October 22, 2026 18:29
lengau
marked this pull request as ready for review
October 22, 2026 18:34
Collaborator
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The documentation accurately reflects the existing initialization behavior, with no unresolved review issues.
No open issues 🎉
What changed in this PR
Clarifies the behavior of charmcraft init --force, explaining that non-empty directories are supported and that --force is only required when template files conflict with existing files.
Changes:
- Updates the init command overview with collision behavior.
- Clarifies that existing files are not overwritten.
- Revises the
--forceoption help text.
| File | Description |
|---|---|
charmcraft/application/commands/init.py |
Updates the init command overview and --force option help text. |
Review effort: Lite
jahn-junior
reviewed
Oct 22, 2026
Co-authored-by: Imani Pelton <imani.pelton@canonical.com> Signed-off-by: Alex Lowe <alex.lowe@canonical.com>
lengau
reviewed
Oct 22, 2026
Signed-off-by: Alex Lowe <alex.lowe@canonical.com>
bepri
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
--forceoption incharmcraft inithad help text indicating it was needed toInitialize even if the directory is not empty (will not overwrite files). In reality,charmcraft initalready allows non-empty directories as long as existing files do not conflict with the template. The--forceflag is only required when files collide, in which case it permits initialisation without overwriting the conflicting files.This change updates:
--forceoption help text and command overview incharmcraft/application/commands/init.py.Verification
make formatmake lint-codemake test-fast