Skip to content

Commit 7bbce0c

Browse files
committed
[PoC] Labs metadata
See databricks/cli#637 for more context
1 parent 34bd186 commit 7bbce0c

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

install.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import os
2+
3+
print(f'host is {os.environ["DATABRICKS_HOST"]}')

labs.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: dbx
3+
context: workspace
4+
description: Databricks CLI extensions
5+
hooks:
6+
install: install.py
7+
entrypoint: main.py
8+
commands:
9+
- name: foo
10+
description: foo command
11+
flags:
12+
- name: first
13+
description: first flag description
14+
- name: second
15+
description: second flag description
16+
- name: bar
17+
description: bar command
18+
flags:
19+
- name: first
20+
description: first flag description
21+
- name: second
22+
description: second flag description

main.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import os, sys, json
2+
3+
print(f'host is {os.environ["DATABRICKS_HOST"]}')
4+
5+
payload = json.loads(sys.argv[1])
6+
print(f'[{payload["command"]}]: flags are {payload["flags"]}')
7+
8+
answer = input('What is your name? ')
9+
10+
print(f'got answer: {answer}')
11+
12+
answer = input('Preferences? ')
13+
14+
print(f'got answer: {answer}')

0 commit comments

Comments
 (0)