getToolArgument extracts the main argument from tool input for display.
(toolName string, input map[string]interface{})
| 226 | |
| 227 | // getToolArgument extracts the main argument from tool input for display. |
| 228 | func getToolArgument(toolName string, input map[string]interface{}) string { |
| 229 | if input == nil { |
| 230 | return "" |
| 231 | } |
| 232 | |
| 233 | switch toolName { |
| 234 | case "Read", "Edit", "Write": |
| 235 | if path, ok := input["file_path"].(string); ok { |
| 236 | return path |
| 237 | } |
| 238 | case "Bash": |
| 239 | if cmd, ok := input["command"].(string); ok { |
| 240 | // Truncate long commands |
| 241 | if len(cmd) > 60 { |
| 242 | return cmd[:57] + "..." |
| 243 | } |
| 244 | return cmd |
| 245 | } |
| 246 | case "Glob": |
| 247 | if pattern, ok := input["pattern"].(string); ok { |
| 248 | return pattern |
| 249 | } |
| 250 | case "Grep": |
| 251 | if pattern, ok := input["pattern"].(string); ok { |
| 252 | return pattern |
| 253 | } |
| 254 | case "WebFetch", "WebSearch": |
| 255 | if url, ok := input["url"].(string); ok { |
| 256 | return url |
| 257 | } |
| 258 | if query, ok := input["query"].(string); ok { |
| 259 | return query |
| 260 | } |
| 261 | case "Task": |
| 262 | if desc, ok := input["description"].(string); ok { |
| 263 | return desc |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | return "" |
| 268 | } |
| 269 | |
| 270 | // IsAutoScrolling returns whether auto-scroll is enabled. |
| 271 | func (l *LogViewer) IsAutoScrolling() bool { |
no outgoing calls