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

Function run_custom

Scripts/Developer Base/Tree Explorer.py:1173–1305  ·  view source on GitHub ↗
(lang: str)

Source from the content-addressed store, hash-verified

1171 ignore=[],
1172 only=[],
1173 )
1174 print(text)
1175 export_path = prompt_text(lang, "prompt_export", "")
1176 export_text(lang, export_path, text)
1177
1178def run_custom(lang: str) -> None:
1179 target = prompt_path(lang, Path("."))
1180 if not target.exists():
1181 print(t("err_path_missing", lang, path=target))
1182 return
1183
1184 show_size = yesno(lang, "prompt_sizes", True)
1185 sort_size = yesno(lang, "prompt_sort", False)
1186 hide_dot = yesno(lang, "prompt_hide_dot", False)
1187 include_hidden = not hide_dot
1188 depth = prompt_int(lang, -1)
1189 follow = yesno(lang, "prompt_follow", False)
1190
1191 ignore = normalize_patterns(prompt_text(lang, "prompt_ignore", ""))
1192 only = normalize_patterns(prompt_text(lang, "prompt_only", ""))
1193
1194 top_n = 0
1195 try:
1196 top_n = int(prompt_text(lang, "prompt_top", "0") or "0")
1197 except ValueError:
1198 top_n = 0
1199
1200 show_summary = yesno(lang, "prompt_summary", True)
1201 export_path = prompt_text(lang, "prompt_export", "")
1202 use_rich = yesno(lang, "prompt_rich", False)
1203
1204 if top_n > 0:
1205 items = list_top_largest_files(
1206 target,
1207 top_n=top_n,
1208 max_depth=depth,
1209 include_hidden=include_hidden,
1210 follow_symlinks=follow,
1211 ignore=ignore,
1212 only=only,
1213 )
1214 out = format_top_list(items) or t('placeholder_empty', lang)
1215 stats = WalkStats() if show_summary else None
1216 if stats is not None:
1217 _ = get_total_size(target, follow_symlinks=follow, ignore=ignore, only=only, include_hidden=include_hidden, stats=stats)
1218 out = (out + "\n" + build_summary_text(lang, stats)).strip()
1219 print(out)
1220 export_text(lang, export_path, out)
1221 return
1222
1223 stats = WalkStats() if show_summary else None
1224 if stats is not None:
1225 _ = get_total_size(target, follow_symlinks=follow, ignore=ignore, only=only, include_hidden=include_hidden, stats=stats)
1226
1227 if use_rich:
1228 ok = ensure_pip_package("rich", "rich")
1229 if ok:
1230 from rich.console import Console

Callers 1

menu_loopFunction · 0.70

Calls 15

printFunction · 0.85
prompt_pathFunction · 0.70
tFunction · 0.70
yesnoFunction · 0.70
prompt_intFunction · 0.70
normalize_patternsFunction · 0.70
prompt_textFunction · 0.70
list_top_largest_filesFunction · 0.70
format_top_listFunction · 0.70
WalkStatsClass · 0.70
get_total_sizeFunction · 0.70
build_summary_textFunction · 0.70

Tested by

no test coverage detected