aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc/spine.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/sisudoc/spine.d')
-rwxr-xr-xsrc/sisudoc/spine.d27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/sisudoc/spine.d b/src/sisudoc/spine.d
index ee3bcef..af4119c 100755
--- a/src/sisudoc/spine.d
+++ b/src/sisudoc/spine.d
@@ -860,12 +860,31 @@ string program_name = "spine";
/+ ↓ 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 +/
@@ -910,7 +929,7 @@ string program_name = "spine";
}
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 +/
@@ -1453,4 +1472,8 @@ 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);
+ }
}