Skip to content
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

feat: allow very_good create . #996

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

a-wallen
Copy link

@a-wallen a-wallen commented Mar 19, 2024

Status

READY/IN DEVELOPMENT/HOLD
READY

Description

Allows . as a project name (like flutter create .)

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • πŸ› οΈ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • βœ… Build configuration change
  • πŸ“ Documentation
  • πŸ—‘οΈ Chore

@a-wallen a-wallen requested a review from a team as a code owner March 19, 2024 07:42
@a-wallen
Copy link
Author

fixes #969

@a-wallen
Copy link
Author

this is ready for review.

by the way, the repo had 37 broken tests when I cloned it on my machine. I was wondering if I should submit those as issues.

@tomarra
Copy link
Contributor

tomarra commented Mar 27, 2024

Fixed the formatting issue by updating from main via #1003 so CI is now passing. @wolfenrain can we get a review here?

Comment on lines +124 to +141
/// The project name that the user provided.
///
/// Since the project name could be user provided as either:
/// 1. A valid package name
/// 2. '.', the current working directory (the project assumes the cwd's name)
/// this needs to exist to provide a fallback value for [outputDirectory] and
/// [projectName].
String get _projectName {
final args = argResults.rest;
_validateProjectName(args);
return args.first;
}

/// Gets the project name.
String get projectName => _projectName == '.'
? path.basename(Directory.current.path)
: _projectName;

Copy link
Member

Choose a reason for hiding this comment

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

I think we should rework this. Introducing . as a projectName and using it to find the name of the directory is kinda confusing because what if I pass path/to/my/folder instead?

. implies current directory which implicitly also means we can pass any path, which isnt the case. However this is the case for flutter create so maybe we should just make it that we can pass any given path and use the last part of that path as the projectName and create the template at the given path.

What you think?

Copy link
Author

Choose a reason for hiding this comment

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

Hi @wolfenrain, thanks for the positive feedback.

I agree, let's do it the same way as the Flutter tool.

This means we'd remove --output-directory as an argument.

As far as very_good create <arg>, here are some requirements that I could implement:

  • Allow relative paths as arg.
  • Allow absolute paths as arg.
  • Use the last path segment of arg as the project name.
  • Remove the --output-directory argument.

Let me know if you'd like me to proceed. Thanks for catching my oversight πŸ‘

Copy link
Member

Choose a reason for hiding this comment

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

I do think that is a good approach, so arg would be any type of path indeed, it would be nice if we can keep backwards compatibility with the --output-directory. Maybe by just checking if it is supplied, if it is show that it is deprecated and just take that over whatever was in arg, assuming arg was a path?

PS: it would be very_good create <template> <output directory>

Copy link
Member

Choose a reason for hiding this comment

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

Hey @a-wallen just following up here to see if you are planning on tackling this still?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants