MCPcopy Create free account
hub / github.com/dataform-co/dataform / promptForIcebergConfig

Function promptForIcebergConfig

cli/util.ts:63–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61 * were provided.
62 */
63export function promptForIcebergConfig(): dataform.IDefaultIcebergConfig | undefined {
64 print(ICEBERG_CONFIG_PROMPT_TEXT);
65 print(ICEBERG_CONFIG_PROMPT_HINT);
66
67 const tempIcebergConfig: dataform.IDefaultIcebergConfig = {};
68
69 let bucketName: string;
70 while (true) {
71 print(ICEBERG_BUCKET_NAME_HINT);
72 bucketName = interactiveQuestion(ICEBERG_BUCKET_NAME_PROMPT_QUESTION);
73 try {
74 if(bucketName) {
75 validateIcebergConfigBucketName(bucketName);
76 tempIcebergConfig.bucketName = bucketName;
77 }
78 break;
79 } catch (e) {
80 printError(`Validation Error: ${e.message}`);
81 print("Please try again.");
82 }
83 }
84
85 let tableFolderRoot: string;
86 while (true) {
87 print(ICEBERG_TABLE_FOLDER_ROOT_HINT);
88 tableFolderRoot = interactiveQuestion(ICEBERG_TABLE_FOLDER_ROOT_PROMPT_QUESTION);
89 try {
90 if (tableFolderRoot) {
91 validateIcebergConfigTableFolderRoot(tableFolderRoot);
92 tempIcebergConfig.tableFolderRoot = tableFolderRoot;
93 }
94 break;
95 } catch (e) {
96 printError(`Validation Error: ${e.message}`);
97 print("Please try again.");
98 }
99 }
100
101 let tableFolderSubpath: string;
102 while (true) {
103 print(ICEBERG_TABLE_FOLDER_ROOT_SUBPATH_HINT)
104 tableFolderSubpath = interactiveQuestion(ICEBERG_TABLE_FOLDER_SUBPATH_PROMPT_QUESTION);
105 try {
106 if (tableFolderSubpath) {
107 validateIcebergConfigTableFolderSubpath(tableFolderSubpath);
108 tempIcebergConfig.tableFolderSubpath = tableFolderSubpath;
109 }
110 break;
111 } catch (e) {
112 printError(`Validation Error: ${e.message}`);
113 print("Please try again.");
114 }
115 }
116
117 let connection: string;
118 while (true) {
119 print(ICEBERG_CONNECTION_HINT)
120 connection = interactiveQuestion(ICEBERG_CONNECTION_QUESTION);

Callers 1

runCliFunction · 0.90

Calls 8

printFunction · 0.90
interactiveQuestionFunction · 0.90
printErrorFunction · 0.90
validateConnectionFormatFunction · 0.90
printSuccessFunction · 0.90

Tested by

no test coverage detected