diff --git a/README.md b/README.md
index e9288ec..218b275 100644
--- a/README.md
+++ b/README.md
@@ -6,18 +6,18 @@ MDQ is a command line tool to query markdown documents which have yaml frontmatt
Usage: `mdq [OPTIONS]
`
### Options
-| Option | Description |
-|---|---|
-| `-j, --json` | Output result as JSON |
-| `-l, --limit ` | Limit number of results returned [default: 0] |
-| `--offset ` | Offset results by a factor. Useful when used with `--limit` [default: 0] |
-| `-f, --filter ` | Filter to apply to the documents. See filter section below. |
+| Option | Description |
+| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `-j, --json` | Output result as JSON |
+| `-l, --limit ` | Limit number of results returned [default: 0] |
+| `--offset ` | Offset results by a factor. Useful when used with `--limit` [default: 0] |
+| `-f, --filter ` | Filter to apply to the documents. See filter section below. |
| `-c, --column ` | Specify output columns. You can rename the text displayed in the header using the `:` character like this: `VariableName:OutputName` [default: file.title:Title] |
-| `-s, --sortby ` | Sort results based on specified key |
-| `-g, --groupby ` | Group results based on specified key |
-| `-r, --reverse` | Reverse the results |
-| `--noheader` | Dont print header in CSV mode. Useful for scripting |
-| `--ignoretags` | Dont search for and add inline `#tags` to tags frontmatter |
+| `-s, --sortby ` | Sort results based on specified key |
+| `-g, --groupby ` | Group results based on specified key |
+| `-r, --reverse` | Reverse the results |
+| `--noheader` | Dont print header in CSV mode. Useful for scripting |
+| `--ignoretags` | Dont search for and add inline `#tags` to tags frontmatter |
## Filters
You can query your document using filters. MDQ uses [jsonfilter](https://git.hydrar.de/jmarya/jsonfilter), so you can query similiar to the `find()` function of MongoDB.
diff --git a/src/main.rs b/src/main.rs
index d0808e5..71a582d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -13,7 +13,14 @@ fn main() {
env_logger::init();
let args = args::get_args();
- let mut i = Index::new(&args.root_dir, args.ignoretags);
+ let root_dir = if args.root_dir == "." {
+ let cwd = std::env::current_dir().unwrap();
+ cwd.to_str().unwrap().to_string()
+ } else {
+ args.root_dir
+ };
+
+ let mut i = Index::new(&root_dir, args.ignoretags);
if !args.filters.is_null() {
i = i.filter_documents(&args.filters);
}