MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / run_list_menu

Function run_list_menu

Scripts/Settings.py:2369–2420  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2367 dirnames[:] = [d for d in dirnames if d not in TERMUX_STATS_SKIP_DIRS and not d.startswith(".")]
2368 for filename in filenames:
2369 if scanned >= max_files:
2370 return snapshot, language_counts, language_bytes, folder_counts, newest_files
2371 full_path = os.path.join(current_root, filename)
2372 if should_skip_stats_path(full_path):
2373 continue
2374 try:
2375 stat = os.stat(full_path)
2376 rel_path = os.path.relpath(full_path, root)
2377 except Exception:
2378 continue
2379 ext = os.path.splitext(filename)[1].lower()
2380 language = LANGUAGE_BY_EXTENSION.get(ext)
2381 snapshot[rel_path] = {
2382 "size": int(stat.st_size),
2383 "mtime": int(stat.st_mtime),
2384 "ext": ext,
2385 }
2386 if language:
2387 language_counts[language] = language_counts.get(language, 0) + 1
2388 language_bytes[language] = language_bytes.get(language, 0) + int(stat.st_size)
2389 folder = os.path.dirname(rel_path) or "."
2390 folder_counts[folder] = folder_counts.get(folder, 0) + 1
2391 newest_files.append((int(stat.st_mtime), rel_path))
2392 scanned += 1
2393
2394 newest_files.sort(reverse=True)
2395 return snapshot, language_counts, language_bytes, folder_counts, newest_files[:10]
2396
2397
2398def summarize_bash_history():
2399 history_paths = [
2400 os.path.join(HOME_DIR, ".bash_history"),
2401 os.path.join(HOME_DIR, ".zsh_history"),
2402 ]
2403 total_commands = 0
2404 command_counts = {}
2405 for history_path in history_paths:
2406 try:
2407 if not os.path.exists(history_path):
2408 continue
2409 with open(history_path, "r", encoding="utf-8", errors="ignore") as handle:
2410 for raw_line in handle:
2411 line = raw_line.strip()
2412 if not line:
2413 continue
2414 if ";" in line and line.startswith(": "):
2415 line = line.split(";", 1)[1].strip()
2416 command = line.split()[0] if line.split() else ""
2417 if command:
2418 total_commands += 1
2419 command_counts[command] = command_counts.get(command, 0) + 1
2420 except Exception:
2421 continue
2422 top_commands = sorted(command_counts.items(), key=lambda item: item[1], reverse=True)[:10]
2423 return total_commands, top_commands

Callers 1

Settings.pyFile · 0.70

Calls 5

printFunction · 0.85
_Function · 0.70
run_selected_fileFunction · 0.70

Tested by

no test coverage detected