@falconer/cli 0.1.0
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/README.md +21 -0
- package/bin/falconer +65 -0
- package/package.json +20 -0
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @falconer/cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for [Falconer](https://falconer.com).
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @falconer/cli
|
|
9
|
+
falconer login
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Commands
|
|
13
|
+
|
|
14
|
+
| Command | Description |
|
|
15
|
+
|---------|-------------|
|
|
16
|
+
| `falconer login` | Authenticate with Falconer |
|
|
17
|
+
| `falconer logout` | Remove stored credentials |
|
|
18
|
+
| `falconer status` | Show current auth state |
|
|
19
|
+
| `falconer read <id>` | Fetch a document |
|
|
20
|
+
| `falconer search <query>` | Search for documents |
|
|
21
|
+
| `falconer create <content>` | Create a new document |
|
package/bin/falconer
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require('child_process')
|
|
4
|
+
const os = require('os')
|
|
5
|
+
const path = require('path')
|
|
6
|
+
|
|
7
|
+
const PLATFORMS = {
|
|
8
|
+
'darwin arm64': {
|
|
9
|
+
package: '@falconer/cli-darwin-arm64',
|
|
10
|
+
binary: 'falconer',
|
|
11
|
+
},
|
|
12
|
+
'darwin x64': {
|
|
13
|
+
package: '@falconer/cli-darwin-x64',
|
|
14
|
+
binary: 'falconer',
|
|
15
|
+
},
|
|
16
|
+
'linux x64': {
|
|
17
|
+
package: '@falconer/cli-linux-x64',
|
|
18
|
+
binary: 'falconer',
|
|
19
|
+
},
|
|
20
|
+
'linux arm64': {
|
|
21
|
+
package: '@falconer/cli-linux-arm64',
|
|
22
|
+
binary: 'falconer',
|
|
23
|
+
},
|
|
24
|
+
'win32 x64': {
|
|
25
|
+
package: '@falconer/cli-windows-x64',
|
|
26
|
+
binary: 'falconer.exe',
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getBinaryPath() {
|
|
31
|
+
const platformKey = `${process.platform} ${os.arch()}`
|
|
32
|
+
const platform = PLATFORMS[platformKey]
|
|
33
|
+
|
|
34
|
+
if (!platform) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
`Unsupported platform: ${platformKey}\n` +
|
|
37
|
+
`Falconer CLI supports: ${Object.keys(PLATFORMS).join(', ')}`
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
const binaryPath = require.resolve(
|
|
43
|
+
`${platform.package}/${platform.binary}`
|
|
44
|
+
)
|
|
45
|
+
return binaryPath
|
|
46
|
+
} catch (e) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
`The package "${platform.package}" could not be found.\n\n` +
|
|
49
|
+
`If you installed with npm, make sure you didn't use "--no-optional" or "--omit=optional".\n` +
|
|
50
|
+
`The "optionalDependencies" feature is used to install the correct binary for your platform.`
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const binaryPath = getBinaryPath()
|
|
56
|
+
const args = process.argv.slice(2)
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
execFileSync(binaryPath, args, { stdio: 'inherit' })
|
|
60
|
+
} catch (e) {
|
|
61
|
+
if (e.status !== undefined) {
|
|
62
|
+
process.exit(e.status)
|
|
63
|
+
}
|
|
64
|
+
throw e
|
|
65
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@falconer/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Falconer CLI - interact with your Falconer documents from the command line",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/FalconerAI/falconer.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"bin": {
|
|
11
|
+
"falconer": "bin/falconer"
|
|
12
|
+
},
|
|
13
|
+
"optionalDependencies": {
|
|
14
|
+
"@falconer/cli-darwin-arm64": "0.1.0",
|
|
15
|
+
"@falconer/cli-darwin-x64": "0.1.0",
|
|
16
|
+
"@falconer/cli-linux-x64": "0.1.0",
|
|
17
|
+
"@falconer/cli-linux-arm64": "0.1.0",
|
|
18
|
+
"@falconer/cli-windows-x64": "0.1.0"
|
|
19
|
+
}
|
|
20
|
+
}
|