← Back to issue list

`charmcraft init` would be better off with explicit directory name

View original Github issue

Metadata

Project
charmcraft
Number
#198
Type
issue
State
closed
Author
markshuttle
Labels
—
Created
Updated
Closed

Current evaluation

Kept directory selection on --project-dir; missing directories are now created by #508 (commit 15d530ae).

Resolution: closed not a bug

Reason: Maintainers decided that --project-dir should remain the standard directory option, so the proposed positional argument was not adopted. The related auto-creation concern was resolved separately by #508 in commit 15d530ae.

Evaluated by: mr-cal-bot

No scores available.

Issue body

The combination of --project-dir and --name in `charmcraft init` is rather awkward. Could we make it that the directory is the only unqualified argument to init, and that --name is then an optional qualified argument along with --author? So: ``` charmcraft init charmcraft init directory charmcraft init --name foo charmcraft init directory --name foo ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed not a bug Kept directory selection on --project-dir; missing directories are now created by #508 (commit 15d530ae).
stealth/space-bunny-alpha — closed not a bug Declined the init syntax change; --project-dir remains Charmcraft's standard directory option. Missing-directory support was added separately in #508 (15d530ae).
stealth/space-bunny-alpha — closed not a bug The positional-directory proposal was declined; maintainers retained the global --project-dir option and separately fixed missing-directory creation.
qwen3.6-35b-a3b-mtp-q6 — — Declined. Maintainers kept --project-dir as the global directory option to avoid CLI conflicts. A separate fix auto-created missing directories, resolving the FileNotFoundError without changing the init syntax.
qwen/qwen3.6-35b-a3b — — Request to simplify charmcraft init directory arguments was rejected. Maintainers kept the global --project-dir flag to avoid duplication. A fix now auto-creates missing directories, resolving the original error. Closed as wontfix.
qwen/qwen3.6-35b-a3b — — Rejected. The positional directory argument was declined to avoid conflicting with the global --project-dir option. The underlying error was resolved by implementing automatic directory creation, addressing the core usability concern.
qwen3.6-35b-a3b-mtp-q6 — — The charmcraft init positional directory proposal was rejected. Maintainers retained --project-dir as a global CLI option. A separate fix now auto-creates missing directories, resolving the original error.

Update history

No update history recorded yet.

Related work

  • Related To: charmcraft#508 (confidence 99%)

    Merged PR adding support for --project-dir when the target directory does not yet exist; implementation commit 15d530ae.

Related issues

Issue Project State Summary Similarity
#514 `charmcraft build` silently omits files called out in `charmcraft.yaml` if executed from an external directory charmcraft closed Fixed by merged PR canonical/charmcraft#525 (merge commit 0d78f540), which runs the parts lifecycle from the project directory so relative globbed paths resolve during external builds.
73%
#433 charmcraft --project-dir does not work for build anymore charmcraft closed Closed as working as designed: maintainer facundobatista explained `build` selects its project dir with `--from`, not `--project-dir` (which `pack` uses), so `charmcraft build --from charm-slurmd/` works.
73%
#1002 Ensure the charm libraries related commands work correctly when command not issued in project's root dir charmcraft closed No library-command fix was recorded; later PRs #1565/#1592 (commit 06c485fc) restricted --project-dir to init and pack.
72%
#2707 Charmcraft confuses the current directory with the project directory when both has a charmcraft.yaml charmcraft open Charmcraft 4.2.1 mixed the CWD and -p project files when both had charmcraft.yaml, breaking nested pack builds and CI; targeted project-directory fixes are present in current code.
71%
#91 First pass at 'charmcraft init' charmcraft merged Merged PR #91 delivered the first non-interactive charmcraft init scaffolding implementation; README improvements, extra options, and prompts were deferred (commit 0ebd9f87).
70%