Skip to content

feat(newproject): add support for '.' directory and --no-project-dir flag to scaffold in current directory like django-admin startproject#175

Merged
Einswilli merged 4 commits intomasterfrom
fix.cli_new_project
Mar 29, 2026
Merged

feat(newproject): add support for '.' directory and --no-project-dir flag to scaffold in current directory like django-admin startproject#175
Einswilli merged 4 commits intomasterfrom
fix.cli_new_project

Conversation

@Einswilli
Copy link
Copy Markdown
Contributor

@Einswilli Einswilli commented Mar 29, 2026

This PR enhances the fletx new command to behave similarly to django-admin startproject by allowing users to scaffold a project directly in the current directory without creating an extra subdirectory, while preserving the existing behavior when a subdirectory is desired.

Changes

  • Made the directory argument optional (defaults to current directory).
  • Added special handling: when directory is ., the command treats it as a request to scaffold in the current directory (equivalent to using --no-project-dir).
  • Added the --no-project-dir flag to explicitly generate project files in the target directory instead of creating a subdirectory named after the project.
  • Updated help text and validation to reflect the new behavior.
  • Fixed indentation issues and ensured proper error handling.

Behavior

  1. Default (subdirectory creation):

    fletx new my_project
    # → creates ./my_project/ with all template files inside
  2. Specified directory (subdirectory inside that path):

    fletx new my_project /path/to/workspace/
    # → creates /path/to/workspace/my_project/ with all template files inside
  3. Scaffold in current directory (using dot):

    fletx new my_project .
    # → generates all template files directly in the current directory (no subdirectory)
  4. Explicit flag (same as dot):

    fletx new my_project --no-project-dir /path/to/workspace/
    # → generates all template files directly in /path/to/workspace/ (no subdirectory)

Impact

  • Provides a more flexible and intuitive project creation workflow.
  • Maintains backward compatibility; existing commands continue to work as before.
  • Enables quick prototyping or integration into existing directories without extra nesting.

All tests pass, and the changes have been verified manually for the three main use cases.

Closes #170

Copy link
Copy Markdown
Contributor

@Wgoeh Wgoeh left a comment

Choose a reason for hiding this comment

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

Great thanks 👍🏾

@Einswilli Einswilli merged commit e86ae6e into master Mar 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a project using the current directory like project name

2 participants