dirsql 0.3.118 → 0.3.120

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,26 +32,61 @@ Two consequences follow directly:
32
32
 
33
33
  ## Writing the path
34
34
 
35
- The path is relative to the **index root** — the directory dirsql is indexing,
36
- not your shell's working directory.
35
+ A `./` path is relative to the **index root** — the directory dirsql is
36
+ indexing, not your shell's working directory.
37
+
38
+ **Directories are recursive by default.** Naming a directory scans everything
39
+ beneath it; the non-recursive form is spelled explicitly with `*`.
37
40
 
38
41
  | You write | dirsql scans |
39
42
  | --- | --- |
40
43
  | `'./'` | every file under the index root, recursively |
44
+ | `'./docs'` | every file under `docs/`, recursively |
45
+ | `'./*'` | files directly inside the index root, and no deeper |
41
46
  | `'./docs/*.md'` | markdown files directly inside `docs/` |
42
47
  | `'./docs/**/*.md'` | markdown files at any depth under `docs/` |
48
+ | `'./notes/today.md'` | exactly that one file — one file is one row |
49
+
50
+ A path containing `*`, `?` or `[` is a glob and is used exactly as written: `*`
51
+ matches within a single directory, `**` crosses directories.
52
+
53
+ A path naming a single file yields exactly one row. dirsql never splits a file
54
+ into rows on its own — that is what a table's `on_file` hook is for.
43
55
 
44
- The `./` is required. A bare glob is rejected with a hint rather than silently
45
- accepted:
56
+ The `./` is required for index-relative paths. A bare glob is rejected with a
57
+ hint rather than silently accepted:
46
58
 
47
59
  ```
48
60
  SELECT * FROM '**/*.md';
49
61
  -- no such table: **/*.md; did you mean './**/*.md'?
50
62
  ```
51
63
 
52
- Absolute (`/var/log/*.log`), parent-relative (`../notes`) and home-relative
53
- (`~/notes`) path-tables are recognized but not yet resolved; they report that
54
- they are unsupported rather than returning wrong rows.
64
+ ### Paths outside the index root
65
+
66
+ Three other prefixes resolve, with their usual shell meanings:
67
+
68
+ | You write | dirsql scans |
69
+ | --- | --- |
70
+ | `'/var/log/*.log'` | an absolute path |
71
+ | `'../notes'` | relative to the index root's parent |
72
+ | `'~/notes/*.md'` | relative to your home directory |
73
+
74
+ `..` is folded out textually, not followed through symlinks, so the directory
75
+ scanned is a function of the string you wrote.
76
+
77
+ **These report absolute `path` values.** A `./` path-table reports paths
78
+ relative to the index root, matching every other dirsql table; a `/`, `../` or
79
+ `~/` path-table has no meaningful relative base — the root it scans is derived
80
+ from the pattern, not named by you — so it reports the full path instead. The
81
+ value you get back is one you can paste into another command:
82
+
83
+ ```sql
84
+ SELECT path FROM '/var/log/*.log';
85
+ -- /var/log/syslog
86
+ ```
87
+
88
+ On a system with no home directory, a `~/` path-table reports that it cannot
89
+ resolve rather than guessing.
55
90
 
56
91
  ## Columns
57
92
 
@@ -60,7 +95,7 @@ table:
60
95
 
61
96
  | Column | Type | Meaning |
62
97
  | --- | --- | --- |
63
- | `path` | TEXT | path relative to the index root |
98
+ | `path` | TEXT | path relative to the index root (absolute for `/`, `../`, `~/` tables) |
64
99
  | `basename` | TEXT | filename with extension |
65
100
  | `dir` | TEXT | parent directory, relative to the index root |
66
101
  | `ext` | TEXT | extension without the dot |
@@ -89,6 +124,26 @@ Path-tables are per-connection and are never written to a persistent cache, so
89
124
  they cannot leak into `sqlite_master` or survive a restart. The reserved
90
125
  top-level `.dirsql/` directory is excluded from the scan, as everywhere else.
91
126
 
127
+ ## Skip rules
128
+
129
+ A path-table scan applies the same [`ignore`](/reference/config) patterns your
130
+ declared tables use, plus two built-in defaults so a zero-config
131
+ `SELECT * FROM './'` does not drown in machinery:
132
+
133
+ - `node_modules/**`
134
+ - `.git/**`
135
+
136
+ Skip rules are judged on the part of the path *below* what you named outright,
137
+ so pointing at a skipped directory still scans it:
138
+
139
+ ```sql
140
+ SELECT path FROM './'; -- no node_modules rows
141
+ SELECT path FROM './node_modules/*/package.json'; -- scans it anyway
142
+ ```
143
+
144
+ Dotfiles are ordinary files: `'./'` and `'./*'` include them. Add an `ignore`
145
+ pattern if you would rather not see them.
146
+
92
147
  ## Joining against declared tables
93
148
 
94
149
  Path-tables are ordinary SQLite tables once resolved, so they join freely:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dirsql",
3
- "version": "0.3.118",
3
+ "version": "0.3.120",
4
4
  "description": "Ephemeral SQL index over a local directory",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/thekevinscott/dirsql",
@@ -212,15 +212,15 @@
212
212
  ]
213
213
  },
214
214
  "optionalDependencies": {
215
- "@dirsql/lib-linux-x64-gnu": "0.3.118",
216
- "@dirsql/lib-linux-arm64-gnu": "0.3.118",
217
- "@dirsql/lib-darwin-x64": "0.3.118",
218
- "@dirsql/lib-darwin-arm64": "0.3.118",
219
- "@dirsql/lib-win32-x64-msvc": "0.3.118",
220
- "@dirsql/cli-linux-x64-gnu": "0.3.118",
221
- "@dirsql/cli-linux-arm64-gnu": "0.3.118",
222
- "@dirsql/cli-darwin-x64": "0.3.118",
223
- "@dirsql/cli-darwin-arm64": "0.3.118",
224
- "@dirsql/cli-win32-x64-msvc": "0.3.118"
215
+ "@dirsql/lib-linux-x64-gnu": "0.3.120",
216
+ "@dirsql/lib-linux-arm64-gnu": "0.3.120",
217
+ "@dirsql/lib-darwin-x64": "0.3.120",
218
+ "@dirsql/lib-darwin-arm64": "0.3.120",
219
+ "@dirsql/lib-win32-x64-msvc": "0.3.120",
220
+ "@dirsql/cli-linux-x64-gnu": "0.3.120",
221
+ "@dirsql/cli-linux-arm64-gnu": "0.3.120",
222
+ "@dirsql/cli-darwin-x64": "0.3.120",
223
+ "@dirsql/cli-darwin-arm64": "0.3.120",
224
+ "@dirsql/cli-win32-x64-msvc": "0.3.120"
225
225
  }
226
226
  }