Skip to content

Commit 330a396

Browse files
Fix new command using incorrect template (#1238)
1 parent 5c30787 commit 330a396

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic
66

77
Releases prior to 7.0 has been removed from this file to declutter search results; see the [archived copy](https://github.com/dipdup-io/dipdup/blob/8.0.0b5/CHANGELOG.md) for the full list.
88

9+
## [Unreleased]
10+
11+
### Fidex
12+
13+
- cli: Fixed `new` command using incorrect template.
14+
915
## [8.3.1] - 2025-04-08
1016

1117
### Added

src/dipdup/cli.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -947,26 +947,25 @@ async def new(
947947

948948
config_dict: dict[str, Any] | None = None
949949

950-
if quiet:
951-
answers = get_default_answers()
952-
if template:
953-
answers['template'] = template
954-
elif replay:
955-
answers = answers_from_replay(replay)
956-
if template:
957-
answers['template'] = template
958-
else:
959-
try:
950+
# NOTE: Collect answers from appropriate source
951+
try:
952+
if quiet:
953+
answers = get_default_answers()
954+
elif replay:
955+
answers = answers_from_replay(replay)
956+
else:
960957
answers = answers_from_terminal()
961-
answers['template'] = template or 'demo_blank'
962958

963-
if template:
964-
echo(f'Using template `{template}`\n')
965-
else:
959+
# NOTE: Handle template selection for interactive mode
960+
if not template:
966961
template, config_dict = template_from_terminal(answers['package'])
967962

968-
except Escape:
969-
return
963+
# NOTE: Priority: CLI arg > interactive selection > default
964+
template = answers['template'] = template or answers.get('template') or 'demo_blank'
965+
966+
_logger.info('Using template `%s`', template)
967+
except Escape:
968+
return
970969

971970
_logger.info('Rendering project')
972971
render_project(answers, force)

0 commit comments

Comments
 (0)