Skip to content

Commit f3cd872

Browse files
committed
fix(cli): avoid interactive prompt when template specified
✨ Prevent interactive template selection when a template is explicitly provided via CLI flags to avoid unexpected prompts during automated or scripted runs 📁 Modified: src/Program.cs, src/solrevdev.seedfolder.csproj 🔧 Added a templateExplicitlySpecified flag and set it when --template/--type/-t is passed; use it to gate the prompt in Program.cs 🛠 Updated sample git commit message to "feat: initial commit" to demonstrate conventional commit prefix 📦 Bumped package version from 1.3.2 to 1.3.3 to publish these fixes
1 parent 748d877 commit f3cd872

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/Program.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public static async Task<int> Main(string[] args)
2727
{
2828
var folderName = "";
2929
var projectType = ProjectType.Markdown; // Default to markdown
30+
var templateExplicitlySpecified = false;
3031
var isDryRun = false;
3132
var isForce = false;
3233
var isQuiet = false;
@@ -80,6 +81,8 @@ public static async Task<int> Main(string[] args)
8081

8182
if (arg is "--template" or "--type" or "-t")
8283
{
84+
templateExplicitlySpecified = true;
85+
8386
if (argIndex + 1 >= args.Length)
8487
{
8588
WriteLine("▲ Error: --template requires a template type.", ConsoleColor.DarkRed);
@@ -134,8 +137,8 @@ public static async Task<int> Main(string[] args)
134137
var sb = new StringBuilder();
135138
if (string.IsNullOrWhiteSpace(folderName))
136139
{
137-
// Interactive template selection
138-
if (projectType == ProjectType.Dotnet) // Only prompt if no template was specified
140+
// Interactive template selection - only prompt if no template was explicitly specified
141+
if (!templateExplicitlySpecified)
139142
{
140143
if (!isQuiet)
141144
{
@@ -619,7 +622,7 @@ private static void ShowGitSetupInstructions(string folderName)
619622
WriteLine("git init", ConsoleColor.DarkYellow);
620623
WriteLine("git lfs install 2>nul || echo Git LFS not available", ConsoleColor.DarkYellow);
621624
WriteLine("git add .", ConsoleColor.DarkYellow);
622-
WriteLine("git commit -m \"Initial commit\"", ConsoleColor.DarkYellow);
625+
WriteLine("git commit -m \"feat: initial commit\"", ConsoleColor.DarkYellow);
623626
}
624627
else
625628
{
@@ -628,7 +631,7 @@ private static void ShowGitSetupInstructions(string folderName)
628631
WriteLine("git init", ConsoleColor.DarkYellow);
629632
WriteLine("git lfs install 2>/dev/null || echo \"Git LFS not available\"", ConsoleColor.DarkYellow);
630633
WriteLine("git add .", ConsoleColor.DarkYellow);
631-
WriteLine("git commit -m \"Initial commit\"", ConsoleColor.DarkYellow);
634+
WriteLine("git commit -m \"feat: initial commit\"", ConsoleColor.DarkYellow);
632635
}
633636

634637
WriteLine("");

src/solrevdev.seedfolder.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<ToolCommandName>seedfolder</ToolCommandName>
1010
<PackageOutputPath>./nupkg</PackageOutputPath>
1111
<NoDefaultExcludes>true</NoDefaultExcludes>
12-
<Version>1.3.2</Version>
12+
<Version>1.3.3</Version>
1313
<Title>solrevdev.seedfolder</Title>
1414
<Description>.NET Core Global Tool that creates a folder and copies dotfiles into it therefore seeding a folder.</Description>
1515
<PackageDescription>.NET Core Global Tool that creates a folder and copies dotfiles into it therefore seeding a folder.</PackageDescription>

0 commit comments

Comments
 (0)