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: smarter initial mode prompt #919

Merged
merged 3 commits into from
Oct 1, 2023
Merged

Conversation

JoshuaKGoldberg
Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg commented Oct 1, 2023

PR Checklist

Overview

Enhances promptForMode to give different options based on the current directory:

  • If it's empty, offer to create a new repository in it or a child directory
  • If it's a Git directory, offer to initialize or migrate
  • If it's not a Git directory, runs create for a new repository in a child directory

In doing so, adds an optional --directory that defaults to the repository's name.

Also cleans up getPrefillOrPromptedOption a bit. Instead of allowing an existingValue parameter, calls to getPrefillOrPromptedOption are just put in the right-hand-side of a ??.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

PR Compliance Checks Passed!

@codecov
Copy link

codecov bot commented Oct 1, 2023

Codecov Report

Merging #919 (9e04a26) into main (dbf0ef9) will decrease coverage by 0.44%.
Report is 1 commits behind head on main.
The diff coverage is 80.39%.

@@            Coverage Diff             @@
##             main     #919      +/-   ##
==========================================
- Coverage   93.77%   93.33%   -0.44%     
==========================================
  Files          90       90              
  Lines        4800     4890      +90     
  Branches      394      402       +8     
==========================================
+ Hits         4501     4564      +63     
- Misses        298      325      +27     
  Partials        1        1              
Flag Coverage Δ
create 71.85% <37.86%> (-0.75%) ⬇️
initialize 37.59% <30.17%> (-0.35%) ⬇️
migrate 70.69% <30.17%> (-0.74%) ⬇️
unit 68.11% <78.92%> (+0.24%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/bin/index.ts 100.00% <100.00%> (ø)
src/bin/promptForMode.ts 100.00% <100.00%> (ø)
src/create/createAndEnterGitDirectory.ts 100.00% <100.00%> (ø)
src/create/index.ts 95.58% <100.00%> (-0.07%) ⬇️
src/initialize/index.ts 97.72% <100.00%> (ø)
src/migrate/index.ts 97.72% <100.00%> (ø)
src/shared/options/args.ts 100.00% <100.00%> (ø)
src/shared/options/createOptionDefaults/index.ts 100.00% <100.00%> (ø)
...options/createOptionDefaults/parsePackageAuthor.ts 100.00% <ø> (ø)
...ons/createOptionDefaults/readDefaultsFromReadme.ts 100.00% <ø> (ø)
... and 4 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@JoshuaKGoldberg JoshuaKGoldberg merged commit 001882b into main Oct 1, 2023
@JoshuaKGoldberg JoshuaKGoldberg deleted the smarter-mode-prompts branch October 1, 2023 14:35
@github-actions
Copy link

github-actions bot commented Oct 2, 2023

🎉 This is included in version v1.32.0 🎉

The release is available on:

Cheers! 📦🚀

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.

🚀 Feature: Enhance/streamline the CLI's startup (mode switching)
1 participant