schema-ai 1.0.0 → 1.0.1
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/bin/schema.js +46 -0
- package/package.json +5 -3
package/bin/schema.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const version = "1.0.1";
|
|
4
|
+
|
|
5
|
+
const help = `schema v${version} - CLI for schema.ai
|
|
6
|
+
|
|
7
|
+
Usage: schema <command> [options]
|
|
8
|
+
|
|
9
|
+
Commands:
|
|
10
|
+
search <query> Search the schema.ai knowledge base
|
|
11
|
+
version Show version
|
|
12
|
+
|
|
13
|
+
Options:
|
|
14
|
+
-h, --help Show this help message
|
|
15
|
+
-v, --version Show version
|
|
16
|
+
|
|
17
|
+
Learn more: https://schema.ai
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
const args = process.argv.slice(2);
|
|
21
|
+
const command = args[0];
|
|
22
|
+
|
|
23
|
+
if (!command || command === "-h" || command === "--help" || command === "help") {
|
|
24
|
+
console.log(help);
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (command === "-v" || command === "--version" || command === "version") {
|
|
29
|
+
console.log(version);
|
|
30
|
+
process.exit(0);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (command === "search") {
|
|
34
|
+
const query = args.slice(1).join(" ");
|
|
35
|
+
if (!query) {
|
|
36
|
+
console.error("Error: search requires a query argument\n");
|
|
37
|
+
console.log("Usage: schema search <query>");
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
console.log(`schema.ai search is coming soon.\n\nIn the meantime, visit https://schema.ai to search for: ${query}`);
|
|
41
|
+
process.exit(0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
console.error(`Unknown command: ${command}\n`);
|
|
45
|
+
console.log(help);
|
|
46
|
+
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "schema-ai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "CLI for schema.ai",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -29,8 +29,10 @@
|
|
|
29
29
|
"license": "Apache-2.0",
|
|
30
30
|
"author": "Mark Soper <mark@schema.ai>",
|
|
31
31
|
"type": "module",
|
|
32
|
-
"
|
|
32
|
+
"bin": {
|
|
33
|
+
"schema": "bin/schema.js"
|
|
34
|
+
},
|
|
33
35
|
"scripts": {
|
|
34
|
-
"test": "
|
|
36
|
+
"test": "node bin/schema.js --version"
|
|
35
37
|
}
|
|
36
38
|
}
|