From 7bbce0c53b756e898acfb14f79a822830603a23c Mon Sep 17 00:00:00 2001 From: Serge Smertin Date: Mon, 7 Aug 2023 13:40:07 +0200 Subject: [PATCH] [PoC] Labs metadata See https://github.com/databricks/cli/pull/637 for more context --- install.py | 3 +++ labs.yml | 22 ++++++++++++++++++++++ main.py | 14 ++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 install.py create mode 100644 labs.yml create mode 100644 main.py diff --git a/install.py b/install.py new file mode 100644 index 00000000..16cfb879 --- /dev/null +++ b/install.py @@ -0,0 +1,3 @@ +import os + +print(f'host is {os.environ["DATABRICKS_HOST"]}') diff --git a/labs.yml b/labs.yml new file mode 100644 index 00000000..49758bbf --- /dev/null +++ b/labs.yml @@ -0,0 +1,22 @@ +--- +name: dbx +context: workspace +description: Databricks CLI extensions +hooks: + install: install.py +entrypoint: main.py +commands: + - name: foo + description: foo command + flags: + - name: first + description: first flag description + - name: second + description: second flag description + - name: bar + description: bar command + flags: + - name: first + description: first flag description + - name: second + description: second flag description \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 00000000..32718997 --- /dev/null +++ b/main.py @@ -0,0 +1,14 @@ +import os, sys, json + +print(f'host is {os.environ["DATABRICKS_HOST"]}') + +payload = json.loads(sys.argv[1]) +print(f'[{payload["command"]}]: flags are {payload["flags"]}') + +answer = input('What is your name? ') + +print(f'got answer: {answer}') + +answer = input('Preferences? ') + +print(f'got answer: {answer}') \ No newline at end of file