@@ -1225,7 +1225,7 @@ function M._Level1(self, dbT, providedByT, possibleA, sn, key, helpFlg)
12251225 if ((m_count == 1 and p_count == 0 ) or (m_count == 0 and p_count == 1 ) or
12261226 (numNames == 1 )) then
12271227 -- io.stderr:write("going level 2: fullName: ",fullName,"\n")
1228- local s = self :_Level2 (sn , fullName , entryMA , entryPA , possibleA , tailMsg )
1228+ local s = self :_Level2 (sn , fullName , entryMA , entryPA , possibleA , tailMsg , key )
12291229 dbg .fini (" Spider:_Level1" )
12301230 return s
12311231 end
@@ -1349,8 +1349,8 @@ function M._Level1(self, dbT, providedByT, possibleA, sn, key, helpFlg)
13491349 return concatTbl (a ," " )
13501350end
13511351
1352- function M ._Level2 (self , sn , fullName , entryA , entryPA , possibleA , tailMsg )
1353- dbg .start {" Spider:_Level2(\" " ,sn ," \" , \" " ,fullName ," \" , entryA, entryPA, possibleA, tailMsg)" }
1352+ function M ._Level2 (self , sn , fullName , entryA , entryPA , possibleA , tailMsg , key )
1353+ dbg .start {" Spider:_Level2(\" " ,sn ," \" , \" " ,fullName ," \" , entryA, entryPA, possibleA, tailMsg, key: \" " , key or " nil " , " \" )" }
13541354 -- dbg.printT("entryA",entryA)
13551355
13561356 local optionTbl = optionTbl ()
@@ -1380,17 +1380,16 @@ function M._Level2(self, sn, fullName, entryA, entryPA, possibleA, tailMsg)
13801380 dbg .printT (" entryA[1]" , entryT )
13811381 dbg .printT (" entryPA" , entryPA )
13821382
1383- -- Early return for terse mode when no dependencies
1384- if (terse and next (entryA ) ~= nil ) then
1385- local hasDependencies = false
1386- for k = 1 , # entryA do
1387- if (entryA [k ].parentAA ) then
1388- hasDependencies = true
1389- break
1390- end
1391- end
1392- if (not hasDependencies ) then
1393- -- Return just the module name, consistent with _Level1 terse output
1383+ -- Early return for terse mode:
1384+ -- - If user searched for a specific module/version (key == fullName), show prerequisites
1385+ -- - If user searched for a module name and got one match (key != fullName), show module name
1386+ -- This fixes the asymmetry issue while preserving the expected behavior for specific version searches
1387+ if (terse and fullName and (next (entryA ) ~= nil or next (entryPA ) ~= nil )) then
1388+ -- If key matches fullName, user searched for specific version - show prerequisites
1389+ if (key and key == fullName ) then
1390+ -- Fall through to show prerequisites (existing behavior)
1391+ else
1392+ -- User searched for module name, got one match - show module name (fix asymmetry)
13941393 dbg .fini (" Spider:_Level2" )
13951394 return fullName .. " \n "
13961395 end
0 commit comments