From 9318cac0fb7299446a2bddfc5c9013cd3841fb9d Mon Sep 17 00:00:00 2001 From: Wister Date: Thu, 16 Mar 2023 02:06:11 -0600 Subject: [PATCH] Fixes --- .../xcshareddata/xcschemes/kubec-cmd.xcscheme | 97 +++++++++++++++++++ .../xcdebugger/Breakpoints_v2.xcbkptlist | 88 +++++++++++++++++ .../xcschemes/xcschememanagement.plist | 8 ++ kubec-cmd/Dirhelper.swift | 8 +- kubec-cmd/FilesManager.swift | 6 +- kubec-cmd/main.swift | 7 +- 6 files changed, 204 insertions(+), 10 deletions(-) create mode 100644 kubec-cmd.xcodeproj/xcshareddata/xcschemes/kubec-cmd.xcscheme create mode 100644 kubec-cmd.xcodeproj/xcuserdata/eddywister.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist diff --git a/kubec-cmd.xcodeproj/xcshareddata/xcschemes/kubec-cmd.xcscheme b/kubec-cmd.xcodeproj/xcshareddata/xcschemes/kubec-cmd.xcscheme new file mode 100644 index 0000000..3d1435f --- /dev/null +++ b/kubec-cmd.xcodeproj/xcshareddata/xcschemes/kubec-cmd.xcscheme @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kubec-cmd.xcodeproj/xcuserdata/eddywister.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/kubec-cmd.xcodeproj/xcuserdata/eddywister.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..35efacf --- /dev/null +++ b/kubec-cmd.xcodeproj/xcuserdata/eddywister.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kubec-cmd.xcodeproj/xcuserdata/eddywister.xcuserdatad/xcschemes/xcschememanagement.plist b/kubec-cmd.xcodeproj/xcuserdata/eddywister.xcuserdatad/xcschemes/xcschememanagement.plist index c35d7e4..f20226f 100644 --- a/kubec-cmd.xcodeproj/xcuserdata/eddywister.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/kubec-cmd.xcodeproj/xcuserdata/eddywister.xcuserdatad/xcschemes/xcschememanagement.plist @@ -10,5 +10,13 @@ 0 + SuppressBuildableAutocreation + + 2F030675291B0A7E00F3C62C + + primary + + + diff --git a/kubec-cmd/Dirhelper.swift b/kubec-cmd/Dirhelper.swift index df1daae..0a45afa 100644 --- a/kubec-cmd/Dirhelper.swift +++ b/kubec-cmd/Dirhelper.swift @@ -9,11 +9,11 @@ import Foundation func PrintInstructions() { print("Kubec-cmd ⛴️") print("Formula ∑ : V1 ⚛️") - print("🛠️---------------------------------🛠️") + print("🛠️---------------------------------------------------------------------------------------------------🛠️") print("Target file 🎯: kubec-cmd -t 'subfix'") - print("🛠️---------------------------------🛠️") + print("🛠️---------------------------------------------------------------------------------------------------🛠️") print("Place Target file ℹ️ : config_'subfix'") - print("🛠️---------------------------------🛠️") + print("🛠️---------------------------------------------------------------------------------------------------🛠️") print("Using a specific context 📝: kubec-cmd -t 'subfix' -c 'context'") - print("🛠️---------------------------------🛠️") + print("🛠️---------------------------------------------------------------------------------------------------🛠️") } diff --git a/kubec-cmd/FilesManager.swift b/kubec-cmd/FilesManager.swift index 061034c..84fed12 100644 --- a/kubec-cmd/FilesManager.swift +++ b/kubec-cmd/FilesManager.swift @@ -89,10 +89,10 @@ func SwitcherConfig() { // Cambia el contexto si se especificó if !_context.isEmpty { - let changeContextCommand = "kubectl config use-context \(_context)" + let changeContextCommand = "config use-context \(_context)" let task = Process() - task.launchPath = "/bin/bash" - task.arguments = ["-c", changeContextCommand] + task.launchPath = "/opt/homebrew/bin/kubectl" + task.arguments = [changeContextCommand] task.launch() task.waitUntilExit() print("Context switched to: \(_context)") diff --git a/kubec-cmd/main.swift b/kubec-cmd/main.swift index 7246630..5b13649 100644 --- a/kubec-cmd/main.swift +++ b/kubec-cmd/main.swift @@ -13,10 +13,11 @@ let kubeconfig = FileManager.default.homeDirectoryForCurrentUser.appendingPathCo PrintInstructions() // Modified to handle both target and context arguments -let (target, context) = ArgsController() +let args = ArgsController() +let target = args.target +let context = args.context -if String(target).isEmpty -{ +if target.isEmpty { print("Fail") }