diff options
Diffstat (limited to 'org/spine.org')
| -rw-r--r-- | org/spine.org | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/org/spine.org b/org/spine.org index c218df0..a8b7cf9 100644 --- a/org/spine.org +++ b/org/spine.org @@ -119,6 +119,10 @@ string program_name = "spine"; foreach (ref _zpr; _zip_pod_extractions) { cleanupZipPod(_zpr); } + /+ ↓ clean up any downloaded temp files +/ + foreach (ref _dlr; _url_downloads) { + cleanupDownload(_dlr); + } } #+END_SRC @@ -1065,12 +1069,31 @@ auto _conf_file_details = configFilePaths!()(_manifested, _env, _opt_action.conf /+ ↓ track extracted zip pod temp directories for cleanup +/ mixin spineExtractZipPod; ZipPodResult[] _zip_pod_extractions; +DownloadResult[] _url_downloads; +/+ ↓ pre-process args: resolve URL arguments to local temp files +/ +string[] _resolved_args; +foreach (arg; args[1..$]) { + if (isUrl(arg)) { + auto _dlr = downloadZipUrl(arg); + if (_dlr.ok) { + _url_downloads ~= _dlr; + _resolved_args ~= _dlr.local_path; + if (_opt_action.vox_gt_1) { + writeln("downloaded: ", arg, " -> ", _dlr.local_path); + } + } else { + writeln("ERROR >> Download failed: ", arg, " - ", _dlr.error_msg); + } + } else { + _resolved_args ~= arg; + } +} ConfComposite _siteConfig; if ( _opt_action.require_processing_files && _opt_action.config_path_set.empty ) { - foreach(arg; args[1..$]) { + foreach(arg; _resolved_args) { if (!(arg.match(rgx.flag_action))) { /+ cli markup source path +/ // get first input markup source file names for processing string _config_arg = arg; /+ ↓ if first non-flag arg is a zip, extract for config discovery +/ @@ -1127,7 +1150,7 @@ if (!(_opt_action.skip_output)) { #+BEGIN_SRC d ConfComposite _make_and_meta_struct = _siteConfig; destroy(_siteConfig); -foreach(arg; args[1..$]) { +foreach(arg; _resolved_args) { if (arg.match(rgx.flag_action)) { /+ cli instruction, flag do +/ flag_action ~= " " ~ arg; // flags not taken by getopt } else if (_opt_action.require_processing_files) { /+ cli, assumed to be path to source files +/ |
