@affinidi/cli 1.31.0 → 1.31.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/package.json +3 -2
- package/scripts/autocomplete.cjs +29 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@affinidi/cli",
|
|
3
|
-
"version": "1.31.
|
|
3
|
+
"version": "1.31.1",
|
|
4
4
|
"description": "Affinidi Elements command-line-interface",
|
|
5
5
|
"author": "affinidi.com",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"/bin",
|
|
14
14
|
"/dist",
|
|
15
|
+
"/scripts/autocomplete.cjs",
|
|
15
16
|
"/npm-shrinkwrap.json",
|
|
16
17
|
"/oclif.manifest.json"
|
|
17
18
|
],
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
"prepare": "node -e \"process.exit(process.env.NODE_ENV === 'production' ? 0 : 1)\" || npm run prepare:dev",
|
|
33
34
|
"remove:dist": "shx rm -rf dist",
|
|
34
35
|
"generate:api": "node scripts/generate-api.cjs",
|
|
35
|
-
"postinstall": "node scripts/autocomplete.cjs"
|
|
36
|
+
"postinstall": "node -e \"process.exit(process.env.NODE_ENV === 'production' ? 1 : 0)\" || node scripts/autocomplete.cjs"
|
|
36
37
|
},
|
|
37
38
|
"publishConfig": {
|
|
38
39
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const { exec } = require('child_process')
|
|
2
|
+
|
|
3
|
+
exec('echo $SHELL', (err, stdout, stderr) => {
|
|
4
|
+
if (err) {
|
|
5
|
+
// node couldn't execute the command
|
|
6
|
+
return
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if(stdout.includes('zsh')){
|
|
10
|
+
execEnvVarCommand('zsh')
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
if(stdout.includes('bash')){
|
|
14
|
+
execEnvVarCommand('bash')
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
console.log('Auto-completion supports only zsh or bash shells.')
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const execEnvVarCommand = (shell) => {
|
|
21
|
+
exec(`printf "eval $(affinidi autocomplete:script ${shell})" >> ~/.${shell}rc; source ~/.${shell}rc`,(err, stdout, stderr) =>{
|
|
22
|
+
if (err){
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
if (stderr){
|
|
26
|
+
console.log("Failed to activate auto-completion")
|
|
27
|
+
}
|
|
28
|
+
return
|
|
29
|
+
} )}
|