@profullstack/nichedb 0.7.0 → 0.7.2
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.
- package/package.json +1 -1
- package/src/index.js +15 -6
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { homedir } from 'node:os';
|
|
|
14
14
|
import { join } from 'node:path';
|
|
15
15
|
import { createInterface } from 'node:readline';
|
|
16
16
|
|
|
17
|
-
export const VERSION = '0.7.
|
|
17
|
+
export const VERSION = '0.7.2';
|
|
18
18
|
const DEFAULT_API = process.env.NICHEDB_API ?? 'https://nichedb.dev';
|
|
19
19
|
const CONFIG_DIR = join(process.env.XDG_CONFIG_HOME ?? join(homedir(), '.config'), 'nichedb');
|
|
20
20
|
const CONFIG_FILE = join(CONFIG_DIR, 'config.json');
|
|
@@ -106,10 +106,19 @@ export const COMMANDS = [
|
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
name: 'match',
|
|
109
|
-
usage: 'match <name> [--collection …] [--kind …] [--year …] [--tags a,b]',
|
|
109
|
+
usage: 'match <name> [--collection …] [--kind …] [--year …] [--date YYYY-MM-DD] [--tags a,b]',
|
|
110
110
|
summary:
|
|
111
|
-
'Which title, channel or fixture is this name? A release name or a playlist entry, cleaned and matched by similarity.',
|
|
112
|
-
options: [
|
|
111
|
+
'Which title, channel or fixture is this name? A release name or a playlist entry, cleaned and matched by similarity; a matchup ("NFL: Chiefs vs Bills") by its two teams, on --date or in the coming week.',
|
|
112
|
+
options: [
|
|
113
|
+
'--collection',
|
|
114
|
+
'--kind',
|
|
115
|
+
'--year',
|
|
116
|
+
'--date',
|
|
117
|
+
'--tags',
|
|
118
|
+
'--limit',
|
|
119
|
+
'--json',
|
|
120
|
+
'--urls',
|
|
121
|
+
],
|
|
113
122
|
},
|
|
114
123
|
{
|
|
115
124
|
name: 'upcoming',
|
|
@@ -540,7 +549,7 @@ export async function run(
|
|
|
540
549
|
const name = rest.join(' ');
|
|
541
550
|
if (!name) throw new Error('match <name>');
|
|
542
551
|
const qs = new URLSearchParams({ q: name });
|
|
543
|
-
for (const k of ['collection', 'kind', 'year', 'tags', 'limit'])
|
|
552
|
+
for (const k of ['collection', 'kind', 'year', 'date', 'tags', 'limit'])
|
|
544
553
|
if (flags[k]) qs.set(k, flags[k]);
|
|
545
554
|
const answer = await client.get(`/api/v1/match?${qs}`);
|
|
546
555
|
if (json) {
|
|
@@ -549,7 +558,7 @@ export async function run(
|
|
|
549
558
|
}
|
|
550
559
|
const p = answer.parsed;
|
|
551
560
|
console.log(
|
|
552
|
-
`read as: ${p.name}${p.year ? ` (${p.year})` : ''}${p.season ? ` S${p.season}` : ''}${p.episode ? `E${p.episode}` : ''} · ${p.kind}`,
|
|
561
|
+
`read as: ${p.league ? `${p.league} ` : ''}${p.name}${p.year ? ` (${p.year})` : ''}${p.season ? ` S${p.season}` : ''}${p.episode ? `E${p.episode}` : ''}${p.date ? ` on ${p.date}` : ''} · ${p.kind}`,
|
|
553
562
|
);
|
|
554
563
|
printItems(
|
|
555
564
|
answer.items.map((i) => ({ ...i, title: `${(i.score * 100).toFixed(0)}% ${i.title}` })),
|