From 69d38374487c4f5e5c3f39722ec6b316c2638472 Mon Sep 17 00:00:00 2001
From: CrazyMax <crazy-max@users.noreply.github.com>
Date: Sun, 18 Sep 2022 02:16:17 +0200
Subject: [PATCH] return driver opts and buildkit version from nodes metadata

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
---
 src/buildx.ts | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/buildx.ts b/src/buildx.ts
index db0d5ca..d81eeeb 100644
--- a/src/buildx.ts
+++ b/src/buildx.ts
@@ -18,8 +18,10 @@ export type Builder = {
 export type Node = {
   name?: string;
   endpoint?: string;
+  'driver-opts'?: Array<string>;
   status?: string;
   'buildkitd-flags'?: string;
+  buildkit?: string;
   platforms?: string;
 };
 
@@ -133,6 +135,10 @@ export async function inspect(name: string, standalone?: boolean): Promise<Build
             node.endpoint = value;
             break;
           }
+          case 'driver options': {
+            node['driver-opts'] = (value.match(/(\w+)="([^"]*)"/g) || []).map(v => v.replace(/^(.*)="(.*)"$/g, '$1=$2'));
+            break;
+          }
           case 'status': {
             node.status = value;
             break;
@@ -141,6 +147,10 @@ export async function inspect(name: string, standalone?: boolean): Promise<Build
             node['buildkitd-flags'] = value;
             break;
           }
+          case 'buildkit': {
+            node.buildkit = value;
+            break;
+          }
           case 'platforms': {
             let platforms: Array<string> = [];
             // if a preferred platform is being set then use only these