mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 20:19:45 +00:00
249 lines
5.8 KiB
Go
249 lines
5.8 KiB
Go
package main
|
|
|
|
import "time"
|
|
|
|
const (
|
|
maxEntries = 30
|
|
maxLargeFiles = 30
|
|
barWidth = 24
|
|
minLargeFileSize = 100 << 20
|
|
defaultViewport = 12
|
|
overviewCacheTTL = 7 * 24 * time.Hour
|
|
overviewCacheFile = "overview_sizes.json"
|
|
duTimeout = 30 * time.Second
|
|
mdlsTimeout = 5 * time.Second
|
|
maxConcurrentOverview = 8
|
|
batchUpdateSize = 100
|
|
cacheModTimeGrace = 30 * time.Minute
|
|
|
|
// Worker pool limits.
|
|
minWorkers = 16
|
|
maxWorkers = 64
|
|
cpuMultiplier = 4
|
|
maxDirWorkers = 32
|
|
openCommandTimeout = 10 * time.Second
|
|
)
|
|
|
|
var foldDirs = map[string]bool{
|
|
// VCS.
|
|
".git": true,
|
|
".svn": true,
|
|
".hg": true,
|
|
|
|
// JavaScript/Node.
|
|
"node_modules": true,
|
|
".npm": true,
|
|
"_npx": true,
|
|
"_cacache": true,
|
|
"_logs": true,
|
|
"_locks": true,
|
|
"_quick": true,
|
|
"_libvips": true,
|
|
"_prebuilds": true,
|
|
"_update-notifier-last-checked": true,
|
|
".yarn": true,
|
|
".pnpm-store": true,
|
|
".next": true,
|
|
".nuxt": true,
|
|
"bower_components": true,
|
|
".vite": true,
|
|
".turbo": true,
|
|
".parcel-cache": true,
|
|
".nx": true,
|
|
".rush": true,
|
|
"tnpm": true,
|
|
".tnpm": true,
|
|
".bun": true,
|
|
".deno": true,
|
|
|
|
// Python.
|
|
"__pycache__": true,
|
|
".pytest_cache": true,
|
|
".mypy_cache": true,
|
|
".ruff_cache": true,
|
|
"venv": true,
|
|
".venv": true,
|
|
"virtualenv": true,
|
|
".tox": true,
|
|
"site-packages": true,
|
|
".eggs": true,
|
|
"*.egg-info": true,
|
|
".pyenv": true,
|
|
".poetry": true,
|
|
".pip": true,
|
|
".pipx": true,
|
|
|
|
// Ruby/Go/PHP (vendor), Java/Kotlin/Scala/Rust (target).
|
|
"vendor": true,
|
|
".bundle": true,
|
|
"gems": true,
|
|
".rbenv": true,
|
|
"target": true,
|
|
".gradle": true,
|
|
".m2": true,
|
|
".ivy2": true,
|
|
"out": true,
|
|
"pkg": true,
|
|
"composer.phar": true,
|
|
".composer": true,
|
|
".cargo": true,
|
|
|
|
// Build outputs.
|
|
"build": true,
|
|
"dist": true,
|
|
".output": true,
|
|
"coverage": true,
|
|
".coverage": true,
|
|
|
|
// IDE.
|
|
".idea": true,
|
|
".vscode": true,
|
|
".vs": true,
|
|
".fleet": true,
|
|
|
|
// Cache directories.
|
|
".cache": true,
|
|
"__MACOSX": true,
|
|
".DS_Store": true,
|
|
".Trash": true,
|
|
"Caches": true,
|
|
".Spotlight-V100": true,
|
|
".fseventsd": true,
|
|
".DocumentRevisions-V100": true,
|
|
".TemporaryItems": true,
|
|
"$RECYCLE.BIN": true,
|
|
".temp": true,
|
|
".tmp": true,
|
|
"_temp": true,
|
|
"_tmp": true,
|
|
".Homebrew": true,
|
|
".rustup": true,
|
|
".sdkman": true,
|
|
".nvm": true,
|
|
|
|
// macOS.
|
|
"Application Scripts": true,
|
|
"Saved Application State": true,
|
|
|
|
// iCloud.
|
|
"Mobile Documents": true,
|
|
|
|
// Containers.
|
|
".docker": true,
|
|
".containerd": true,
|
|
|
|
// Mobile development.
|
|
"Pods": true,
|
|
"DerivedData": true,
|
|
".build": true,
|
|
"xcuserdata": true,
|
|
"Carthage": true,
|
|
".dart_tool": true,
|
|
|
|
// Web frameworks.
|
|
".angular": true,
|
|
".svelte-kit": true,
|
|
".astro": true,
|
|
".solid": true,
|
|
|
|
// Databases.
|
|
".mysql": true,
|
|
".postgres": true,
|
|
"mongodb": true,
|
|
|
|
// Other.
|
|
".terraform": true,
|
|
".vagrant": true,
|
|
"tmp": true,
|
|
"temp": true,
|
|
}
|
|
|
|
var skipSystemDirs = map[string]bool{
|
|
"dev": true,
|
|
"tmp": true,
|
|
"private": true,
|
|
"cores": true,
|
|
"net": true,
|
|
"home": true,
|
|
"System": true,
|
|
"sbin": true,
|
|
"bin": true,
|
|
"etc": true,
|
|
"var": true,
|
|
"opt": false,
|
|
"usr": false,
|
|
"Volumes": true,
|
|
"Network": true,
|
|
".vol": true,
|
|
".Spotlight-V100": true,
|
|
".fseventsd": true,
|
|
".DocumentRevisions-V100": true,
|
|
".TemporaryItems": true,
|
|
".MobileBackups": true,
|
|
}
|
|
|
|
var defaultSkipDirs = map[string]bool{
|
|
"nfs": true,
|
|
"PHD": true,
|
|
"Permissions": true,
|
|
}
|
|
|
|
var skipExtensions = map[string]bool{
|
|
".go": true,
|
|
".js": true,
|
|
".ts": true,
|
|
".tsx": true,
|
|
".jsx": true,
|
|
".json": true,
|
|
".md": true,
|
|
".txt": true,
|
|
".yml": true,
|
|
".yaml": true,
|
|
".xml": true,
|
|
".html": true,
|
|
".css": true,
|
|
".scss": true,
|
|
".sass": true,
|
|
".less": true,
|
|
".py": true,
|
|
".rb": true,
|
|
".java": true,
|
|
".kt": true,
|
|
".rs": true,
|
|
".swift": true,
|
|
".m": true,
|
|
".mm": true,
|
|
".c": true,
|
|
".cpp": true,
|
|
".h": true,
|
|
".hpp": true,
|
|
".cs": true,
|
|
".sql": true,
|
|
".db": true,
|
|
".lock": true,
|
|
".gradle": true,
|
|
".mjs": true,
|
|
".cjs": true,
|
|
".coffee": true,
|
|
".dart": true,
|
|
".svelte": true,
|
|
".vue": true,
|
|
".nim": true,
|
|
".hx": true,
|
|
}
|
|
|
|
var spinnerFrames = []string{"|", "/", "-", "\\", "|", "/", "-", "\\"}
|
|
|
|
const (
|
|
colorPurple = "\033[0;35m"
|
|
colorPurpleBold = "\033[1;35m"
|
|
colorGray = "\033[0;90m"
|
|
colorRed = "\033[0;31m"
|
|
colorYellow = "\033[0;33m"
|
|
colorGreen = "\033[0;32m"
|
|
colorBlue = "\033[0;34m"
|
|
colorCyan = "\033[0;36m"
|
|
colorReset = "\033[0m"
|
|
colorBold = "\033[1m"
|
|
)
|