| 349 | } |
| 350 | } |
| 351 | void G4VBasicShell::TerminalHelp(const G4String& newCommand) |
| 352 | { |
| 353 | G4UImanager* UI = G4UImanager::GetUIpointer(); |
| 354 | if (UI == nullptr) return; |
| 355 | G4UIcommandTree* treeTop = UI->GetTree(); |
| 356 | size_t i = newCommand.find(' '); |
| 357 | if (i != std::string::npos) { |
| 358 | G4String newValue = newCommand.substr(i + 1, newCommand.length() - (i + 1)); |
| 359 | G4StrUtil::strip(newValue); |
| 360 | G4String targetCom = ModifyToFullPathCommand(newValue); |
| 361 | G4UIcommand* theCommand = treeTop->FindPath(targetCom); |
| 362 | if (theCommand != nullptr) { |
| 363 | theCommand->List(); |
| 364 | return; |
| 365 | } |
| 366 | |
| 367 | G4cout << "Command <" << newValue << " is not found." << G4endl; |
| 368 | return; |
| 369 | } |
| 370 | |
| 371 | G4UIcommandTree* floor[10]; |
| 372 | floor[0] = treeTop; |
| 373 | size_t iFloor = 0; |
| 374 | size_t prefixIndex = 1; |
| 375 | G4String prefix = GetCurrentWorkingDirectory(); |
| 376 | while (prefixIndex < prefix.length() - 1) { |
| 377 | size_t ii = prefix.find('/', prefixIndex); |
| 378 | floor[iFloor + 1] = floor[iFloor]->GetTree(G4String(prefix.substr(0, ii + 1))); |
| 379 | prefixIndex = ii + 1; |
| 380 | iFloor++; |
| 381 | } |
| 382 | floor[iFloor]->ListCurrentWithNum(); |
| 383 | // 1998 Oct 2 non-number input |
| 384 | while (true) { |
| 385 | // G4cout << G4endl << "Type the number ( 0:end, -n:n level back ) : "<<std::flush; |
| 386 | G4cout << G4endl << "Type the number ( 0:end, -n:n level back ) : " << G4endl; |
| 387 | G4int j; |
| 388 | if (! GetHelpChoice(j)) { |
| 389 | G4cout << G4endl << "Not a number, once more" << G4endl; |
| 390 | continue; |
| 391 | } |
| 392 | if (j < 0) { |
| 393 | if (iFloor < (size_t)-j) |
| 394 | iFloor = 0; |
| 395 | else |
| 396 | iFloor += j; |
| 397 | // iFloor += j; |
| 398 | // if( iFloor < 0 ) iFloor = 0; |
| 399 | floor[iFloor]->ListCurrentWithNum(); |
| 400 | continue; |
| 401 | } |
| 402 | if (j == 0) { |
| 403 | break; |
| 404 | } |
| 405 | if (j > 0) { |
| 406 | G4int n_tree = floor[iFloor]->GetTreeEntry(); |
| 407 | if (j > n_tree) { |
| 408 | if (j <= n_tree + floor[iFloor]->GetCommandEntry()) { |
nothing calls this directly
no test coverage detected