-
Notifications
You must be signed in to change notification settings - Fork 380
Expand file tree
/
Copy pathprintEnvironment.ts
More file actions
40 lines (33 loc) · 1.04 KB
/
printEnvironment.ts
File metadata and controls
40 lines (33 loc) · 1.04 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
import * as vscode from 'vscode'
import { getSqlmeshEnvironment } from '../utilities/sqlmesh/sqlmesh'
import { isErr } from '@bus/result'
import { IS_WINDOWS } from '../utilities/isWindows'
export function printEnvironment() {
return async () => {
const envResult = await getSqlmeshEnvironment()
if (isErr(envResult)) {
await vscode.window.showErrorMessage(envResult.error)
return
}
const env = envResult.value
// Create a new terminal with the SQLMesh environment
const terminal = vscode.window.createTerminal({
name: 'SQLMesh Environment',
env: env,
})
// Show the termina
terminal.show()
// Run the appropriate command to display environment variables
if (IS_WINDOWS) {
// On Windows, use 'set' command
terminal.sendText('set')
} else {
// On Unix-like systems, use 'env' command
terminal.sendText('env | sort')
}
// Show a notification
vscode.window.showInformationMessage(
'SQLMesh environment variables displayed in terminal',
)
}
}