-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathdotenv-vault.ts
121 lines (113 loc) · 2.87 KB
/
dotenv-vault.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import { filepaths } from "@fig/autocomplete-generators";
// Common Options
const yesOption: Fig.Option = {
name: ["--yes", "-y"],
description:
"Automatic yes to prompts. Assume yes to all prompts and run non-interactively",
};
const dotenvMeOption: Fig.Option = {
name: ["-m", "--dotenvMe"],
description:
"Pass .env.me (DOTENV_ME) credential directly (rather than reading from .env.me file)",
args: {
name: "DOTENV_ME",
description: "Pass .env.me (DOTENV_ME) credential directly",
},
};
// Common Arguments
const dotenvVaultArg = {
name: "DOTENV_VAULT",
description: "Set .env.vault identifier. Defaults to generated value",
isOptional: true,
};
const dotenvMeArg = {
name: "DOTENV_ME",
description: "Set .env.me credential. Defaults to generated value",
isOptional: true,
};
const environmentArg = {
name: "ENVIRONMENT",
description: "Set environment to open to. Defaults to development",
isOptional: true,
};
const filenameArg = {
name: "FILENAME",
description:
"Set input filename. Defaults to .env for development and .env.{environment} for other environments",
isOptional: true,
generators: filepaths({ matches: /^\.env.*$/ }),
};
const completionSpec: Fig.Spec = {
name: "dotenv-vault",
description: "CLI for dotenv-vault",
options: [
{
name: "--help",
description: "Get documentation for the command",
isPersistent: true,
},
],
subcommands: [
{
name: "new",
description: "Create your project",
options: [yesOption],
args: dotenvVaultArg,
},
{
name: "login",
description: "Log in to dotenv-vault",
options: [yesOption],
args: dotenvMeArg,
},
{
name: "logout",
description: "Log out from dotenv-vault",
options: [yesOption],
},
{
name: "open",
description: "Opens project page in a browser",
options: [yesOption],
args: environmentArg,
},
{
name: "push",
description: "Push .env securely",
options: [yesOption, dotenvMeOption],
args: [environmentArg, filenameArg],
},
{
name: "pull",
description: "Pull .env securely",
options: [yesOption, dotenvMeOption],
args: [environmentArg, filenameArg],
},
{
name: "versions",
description: "List version history",
options: [yesOption, dotenvMeOption],
args: [environmentArg, filenameArg],
},
{
name: "whoami",
description: "Display the current logged in user",
options: [dotenvMeOption],
},
{
name: "status",
description: "Check dotenv-operational status",
options: [yesOption],
},
{
name: "help",
description: "Display help for dotenv-vault",
},
{
name: "update",
description: "Update the dotenv-vault CLI",
options: [yesOption],
},
],
};
export default completionSpec;