diff --git a/README.md b/README.md index 703be89..4738175 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,12 @@ Here's what has been worked on so far. - [x] Modes - [x] Oneoff - [x] Swallow + - [ ] `@mode` in commands - [x] Comments - [x] Imports - - [x] Merge bindings from all imports + - [x] Merge definitions from all imports - [ ] Tests (WIP) -- [ ] Integration into downstream (WIP) +- [ ] Integration into downstream [WIP](https://github.com/lavafroth/swhkd/tree/sweet-integration) ## Extra features - [x] Warn user if input config is not a regular file diff --git a/src/lib.rs b/src/lib.rs index 800f56c..e8870f6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -74,6 +74,7 @@ pub fn read_config>(path: P) -> Result { if size > (50 << 20) { return Err(ConfigReadError::TooLarge(path.to_path_buf())); } + // TODO: Use mmap instead of fs::read_to_string Ok(fs::read_to_string(path)?) } @@ -86,8 +87,8 @@ impl SwhkdParser { } fn as_import(input: ParserInput, seen: &mut BTreeSet) -> Result { let (raw, source) = match input { + // If a config is loaded from a string instead of a path, name it `` ParserInput::Raw(s) => (s.to_string(), ""), - // TODO: Use mmap instead of fs::read_to_string ParserInput::Path(p) => (read_config(p)?, p.to_str().unwrap_or_default()), }; let parse_result = SwhkdGrammar::parse(Rule::main, &raw)