diff --git a/README.md b/README.md index 1bb21e7..4debf04 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,10 @@ cat myfile | tree-query '{and: [[Page 1]] [[Page 2]]}' [*Learn to build powerful no-code applications using pipes*](https://youtu.be/tc4ROCJYbm0?t=360) ## Installation +### [Download a copy](https://github.com/CrazyPython/tree-query/releases/tag/v0.1.1) +The more convenient method. Click above for instructions. ### Build from source -Currently the only supported method. DYI style. On FreeBSD, GNU+Linux, and macOS, open Terminal and go: ``` @@ -90,6 +91,16 @@ tree-query '{and: [[Page 1]] [[Page 2]]}' . | xclip ## Contributing +**query.d**: The logic for executing Roam queries + +**parser.d**: The Markdown/org-mode parser, which detects the indentation level of each line and uses it to emit a stream of events for a handler like `query.d` to consume. + +**tree-query.d**: The command-line tool/wrapper. Recursively parses the string `{and: [[Page 1]] [[Page 2]]}` into a tree of expressions + +**interp.d**: Recursively evaluates boolean expressions on behalf of query.d + +`tree-query` has doc comments on internals and example code demonstrating how internal APIs work. (Ctrl-F for "unittest") + Tree-query is written in [Dlang](https://dlang.org) but don't let that put you off- if you know C, C++, or Java, you'll pick it up very quickly. If you have any questions on D, feel free to go to #d on freenode or D Forums. People are very nice. @@ -107,4 +118,21 @@ A string in D is a reference to a region of immutable memory. It is a length and A struct is like a Java record or class. ## Known bugs - - Mixing tabs and spaces is not supported in the same file, unless an explicit spaces per indent specified + - Mixing tabs and spaces in the same file is not supported, unless an explicit spaces per indent specified + +## Your rights + +This is open-source software. + +We use copyleft to gurantee these rights: + +0. Free for commercial use and any other purpose +1. Freedom to remix to fit your needs: You (and if you can't code, by proxy a programmer you hire) have freedom to add new query keywords, completely change the query system, add support for new formats like org-mode, or anything else +2. Freedom to help friends by sharing +3. Freedom to share remixes, commercially and noncommercially + +I believe knowledge management is a deeply, and everyone should have freedom over their "digital brain." A digital brain is a deeply intimate and personal thing. This means you are the sovereign of your digital brain. + +Compatible with permissive licenses like Apache License, MIT License, and Mozilla Public License. + +(C) 2021. Affero General Public License v3.0 or any later version diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 3f07b60..d6b48e2 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,13 +1,13 @@ # Release notes -## 0.0.2 +## 0.1.1 - Added hyperlinked documentation on usage instructions for people new to the CLI - Added missing source files, now it's possible to compile - Support for starting queries with `{query:` was enabled - Shows message when executed without a query - Fixed build instructions for Windows and added a binary release for Windows and Mac -## 0.0.1 +## 0.1.0 - Supports `{and:`, `{or:`, `{not:`, nested arbitrarily, querying using page references - Works on any kind of indentation, including tabs, spaces. - Caveat: Mixing tabs and spaces in one file may lead to undesired results, because a tab is interpreted as one space diff --git a/parser.d b/parser.d index 68a5c2b..ae1389b 100644 --- a/parser.d +++ b/parser.d @@ -14,6 +14,7 @@ int count_indents(ref int i, string input, int spaces_per_indent=4) { for (; i < input.length; ++i) { switch (input[i]) { case ' ': nspaces++; break; + case '*': nspaces++; break; case '\t': nspaces += spaces_per_indent; break; // Commented out makes it only accept "-" //case '-': return nspaces / spaces_per_indent;