Skip to content

Commit

Permalink
docs: document last feature in modes
Browse files Browse the repository at this point in the history
  • Loading branch information
lavafroth committed Jul 4, 2024
1 parent cd962d2 commit 20a7a34
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ pub fn read_config<P: AsRef<Path>>(path: P) -> Result<String, ConfigReadError> {
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)?)
}

Expand All @@ -86,8 +87,8 @@ impl SwhkdParser {
}
fn as_import(input: ParserInput, seen: &mut BTreeSet<String>) -> Result<Self, ParseError> {
let (raw, source) = match input {
// If a config is loaded from a string instead of a path, name it `<anonymous>`
ParserInput::Raw(s) => (s.to_string(), "<anonymous>"),
// 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)
Expand Down

0 comments on commit 20a7a34

Please sign in to comment.