summaryrefslogtreecommitdiff
path: root/dhall/src/semantics
diff options
context:
space:
mode:
authorNadrieril2020-03-01 19:37:24 +0000
committerNadrieril2020-03-05 15:58:54 +0000
commit5a9a5859eec0cf7deebf7fa07fe99f8dc8722ec8 (patch)
tree838f55765c65d5dd8c701670cd78b1908467e383 /dhall/src/semantics
parentdf4495f30708180591b630bb720cfe81ff4118ce (diff)
Implement remote `as Location` resolution
Diffstat (limited to 'dhall/src/semantics')
-rw-r--r--dhall/src/semantics/resolve/resolve.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/dhall/src/semantics/resolve/resolve.rs b/dhall/src/semantics/resolve/resolve.rs
index f419858..8a8c9b6 100644
--- a/dhall/src/semantics/resolve/resolve.rs
+++ b/dhall/src/semantics/resolve/resolve.rs
@@ -1,3 +1,4 @@
+use itertools::Itertools;
use std::borrow::Cow;
use std::env;
use std::path::PathBuf;
@@ -127,11 +128,21 @@ fn resolve_one_import(
.into_owned();
("Local", Some(path))
}
+ ImportLocation::Remote(url) => {
+ let path =
+ url.path.canonicalize().file_path.iter().join("/");
+ let mut url_str =
+ format!("{}://{}/{}", url.scheme, url.authority, path);
+ if let Some(q) = &url.query {
+ url_str.push('?');
+ url_str.push_str(q.as_ref());
+ }
+ ("Remote", Some(url_str))
+ }
ImportLocation::Env(name) => {
("Environment", Some(name.clone()))
}
ImportLocation::Missing => ("Missing", None),
- _ => unimplemented!("{:?}", import),
};
let asloc_ty = make_aslocation_uniontype();