feat(cdn): enhance delete with folder support, add sync progress events, and bash() function

- Enhanced cdnDelete to recursively delete folders with per-file tracking and error counts
- Added optional 'json' mode parameter to cdnSyncUpload/cdnSyncDownload for output format control
- Implemented real-time sync event callbacks for progress visualization with colored terminal output
- Added bash() as primary function with exec_cmd() as alias for backward compatibility
- Introduced SyncEvent type for action tracking (uploading/downloaded/skipped/deleted/error)
- Updated function tests to support new mode parameter
This commit is contained in:
j3ssie
2026-01-25 21:07:58 +08:00
parent 8ffbc91d43
commit 1fd3f09a9b
8 changed files with 273 additions and 35 deletions
+3 -3
View File
@@ -453,12 +453,12 @@ func runFunctionList(cmd *cobra.Command, args []string) error {
// to work the same as "osmedeus eval cdn_ls_tree()"
func normalizeScriptExpression(expr string) string {
expr = strings.TrimSpace(expr)
// If it already has parentheses, return as-is
if strings.Contains(expr, "(") {
return expr
}
// Check if it's a known function name
allFuncs := functions.AllFunctions()
for _, fn := range allFuncs {
@@ -469,7 +469,7 @@ func normalizeScriptExpression(expr string) string {
return expr + "()"
}
}
// Not a known function, return as-is (could be a variable or expression)
return expr
}