Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyv73 committed Mar 16, 2023
1 parent 258c39b commit 9318cac
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 10 deletions.
97 changes: 97 additions & 0 deletions kubec-cmd.xcodeproj/xcshareddata/xcschemes/kubec-cmd.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2F030675291B0A7E00F3C62C"
BuildableName = "kubec-cmd"
BlueprintName = "kubec-cmd"
ReferencedContainer = "container:kubec-cmd.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
viewDebuggingEnabled = "No">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2F030675291B0A7E00F3C62C"
BuildableName = "kubec-cmd"
BlueprintName = "kubec-cmd"
ReferencedContainer = "container:kubec-cmd.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "-c"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "aks-edb-dev-eus2-01"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "-t"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "main"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2F030675291B0A7E00F3C62C"
BuildableName = "kubec-cmd"
BlueprintName = "kubec-cmd"
ReferencedContainer = "container:kubec-cmd.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "08BD41A1-8C4B-4DE8-AC82-AD3C285446FB"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "9E98CD89-B9C9-43BB-8BCC-FEF00E04B7AB"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kubec-cmd/main.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "18"
endingLineNumber = "18"
landmarkName = "unknown"
landmarkType = "0">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "0AE190E8-A6D5-4C90-AAC3-3962E135CEEB"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kubec-cmd/main.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "17"
endingLineNumber = "17"
landmarkName = "unknown"
landmarkType = "0">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "4CF586D1-E5CC-451C-A695-C73F2EB47C45"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kubec-cmd/FilesManager.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "92"
endingLineNumber = "92"
landmarkName = "SwitcherConfig()"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "3F36C0E9-159E-4249-AB39-832340C65F70"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kubec-cmd/FilesManager.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "73"
endingLineNumber = "73"
landmarkName = "SwitcherConfig()"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "DDA7B181-893A-47E6-9CF0-4E876A0270A9"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "kubec-cmd/FilesManager.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "19"
endingLineNumber = "19"
landmarkName = "SearchFiles(target:context:)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,13 @@
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>2F030675291B0A7E00F3C62C</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
8 changes: 4 additions & 4 deletions kubec-cmd/Dirhelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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("🛠️---------------------------------------------------------------------------------------------------🛠️")
}
6 changes: 3 additions & 3 deletions kubec-cmd/FilesManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down
7 changes: 4 additions & 3 deletions kubec-cmd/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down

0 comments on commit 9318cac

Please sign in to comment.