96{
99
100
101 newCommand =
shell_-> GetCommandLineString(msg);
102
104 if( nC.length() == 0 ) {
105 newCommand = nullString;
106
107 } else if( nC[0] == '#' ) {
108 G4cout << nC << G4endl;
109 newCommand = nullString;
110
111 } else if( nC == "ls" || nC.substr(0,3) == "ls " ) {
112 ListDirectory(nC);
113 newCommand = nullString;
114
115 } else if( nC == "lc" || nC.substr(0,3) == "lc " ) {
116 shell_-> ListCommand(nC.erase(0,2));
117 newCommand = nullString;
118
119 } else if( nC == "pwd" ) {
120 G4cout << "Current Command Directory : "
121 << GetCurrentWorkingDirectory() << G4endl;
122 newCommand = nullString;
123
124 } else if( nC == "cwd" ) {
125 shell_-> ShowCurrentDirectory();
126 newCommand = nullString;
127
128 } else if(nC == "cd" || nC.substr(0,3) == "cd " ) {
129 ChangeDirectoryCommand(nC);
130 shell_-> SetCurrentDirectory(GetCurrentWorkingDirectory());
131 newCommand = nullString;
132
133 } else if( nC == "help" || nC.substr(0,5) == "help " ) {
134 TerminalHelp(nC);
135 newCommand = nullString;
136
137 } else if( nC[0] == '?' ) {
138 ShowCurrent(nC);
139 newCommand = nullString;
140
141 } else if( nC == "hist" || nC == "history" ) {
142 G4int nh= ::UI-> GetNumberOfHistory();
143 for( G4int i = 0; i<nh; i++ ) {
144 G4cout << i << ": " << ::UI-> GetPreviousCommand(i) << G4endl;
145 }
146 newCommand = nullString;
147
148 } else if( nC[0] == '!' ) {
149 G4String ss = nC.substr(1, nC.length()-1);
150 G4int vl;
151 const char* tt = ss;
152 std::istringstream is(tt);
153 is >> vl;
154 G4int nh = ::UI-> GetNumberOfHistory();
155 if( vl>=0 && vl<nh ) {
156 newCommand = ::UI-> GetPreviousCommand(vl);
157 G4cout << newCommand << G4endl;
158 } else {
159 G4cerr << "history " << vl << " is not found." << G4endl;
160 newCommand = nullString;
161 }
162
163 } else if( nC.empty() ) {
164 newCommand = nullString;
165
166 } else if( nC == "exit" ) {
167 return "exit";
168
169 } else {
170
171 }
172
174 return ModifyToFullPathCommand(newCommand);
175}
G4String TruncateCommand(const G4String &command) const
G4String lstrip_copy(G4String str, char ch=' ')