diff options
Diffstat (limited to '')
-rw-r--r-- | dhall/src/semantics/resolve/resolve.rs | 13 | ||||
-rw-r--r-- | dhall/src/syntax/text/printer.rs | 2 |
2 files changed, 13 insertions, 2 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(); diff --git a/dhall/src/syntax/text/printer.rs b/dhall/src/syntax/text/printer.rs index 8891d41..53f2c8f 100644 --- a/dhall/src/syntax/text/printer.rs +++ b/dhall/src/syntax/text/printer.rs @@ -406,7 +406,7 @@ impl<SubExpr: Display> Display for Import<SubExpr> { f.write_str(&path)?; } Remote(url) => { - write!(f, "{}://{}/", url.scheme, url.authority,)?; + write!(f, "{}://{}/", url.scheme, url.authority)?; let path: String = url.path.file_path.iter().join("/"); f.write_str(&path)?; if let Some(q) = &url.query { |