-
Notifications
You must be signed in to change notification settings - Fork 675
Expand file tree
/
Copy pathenv.ts
More file actions
53 lines (48 loc) · 1.34 KB
/
env.ts
File metadata and controls
53 lines (48 loc) · 1.34 KB
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
import type { ProjectCommandArguments } from '../../types/commands/common_arguments';
import { SlackCLIProcess } from '../cli-process';
export interface EnvCommandArguments {
/** @description Environment variable key */
secretKey: string;
/** @description Environment variable value */
secretValue: string;
}
/**
* `slack env set`
* @returns command output
*/
export const set = async function envSet(args: ProjectCommandArguments & EnvCommandArguments): Promise<string> {
const cmd = new SlackCLIProcess(['env', 'set', args.secretKey, args.secretValue], args);
const proc = await cmd.execAsync({
cwd: args.appPath,
});
return proc.output;
};
/**
* `slack env list`
* @returns command output
*/
export const list = async function envList(args: ProjectCommandArguments): Promise<string> {
const cmd = new SlackCLIProcess(['env', 'list'], args);
const proc = await cmd.execAsync({
cwd: args.appPath,
});
return proc.output;
};
/**
* `slack env unset`
* @returns command output
*/
export const unset = async function envUnset(
args: ProjectCommandArguments & Pick<EnvCommandArguments, 'secretKey'>,
): Promise<string> {
const cmd = new SlackCLIProcess(['env', 'unset', args.secretKey], args);
const proc = await cmd.execAsync({
cwd: args.appPath,
});
return proc.output;
};
export default {
set,
list,
unset,
};