From 8c5a1b300c62ad561830393dc780c3b5430be093 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Wed, 10 Apr 2024 23:11:21 +0100 Subject: [PATCH] more shell completions --- Sources/tart/Commands/Export.swift | 2 +- Sources/tart/Commands/IP.swift | 2 +- Sources/tart/Commands/Push.swift | 2 +- Sources/tart/Commands/Rename.swift | 2 +- Sources/tart/Commands/Set.swift | 2 +- Sources/tart/Commands/Stop.swift | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/tart/Commands/Export.swift b/Sources/tart/Commands/Export.swift index f0b5dcae..5e70ae8a 100644 --- a/Sources/tart/Commands/Export.swift +++ b/Sources/tart/Commands/Export.swift @@ -4,7 +4,7 @@ import Foundation struct Export: AsyncParsableCommand { static var configuration = CommandConfiguration(abstract: "Export VM to a compressed .tvm file") - @Argument(help: "Source VM name.") + @Argument(help: "Source VM name.", completion: .custom(completeMachines)) var name: String @Argument(help: "Path to the destination file.") diff --git a/Sources/tart/Commands/IP.swift b/Sources/tart/Commands/IP.swift index 662d49e2..77d93d2d 100644 --- a/Sources/tart/Commands/IP.swift +++ b/Sources/tart/Commands/IP.swift @@ -13,7 +13,7 @@ enum IPResolutionStrategy: String, ExpressibleByArgument, CaseIterable { struct IP: AsyncParsableCommand { static var configuration = CommandConfiguration(abstract: "Get VM's IP address") - @Argument(help: "VM name") + @Argument(help: "VM name", completion: .custom(completeLocalMachines)) var name: String @Option(help: "Number of seconds to wait for a potential VM booting") diff --git a/Sources/tart/Commands/Push.swift b/Sources/tart/Commands/Push.swift index eb418366..a8b5aa12 100644 --- a/Sources/tart/Commands/Push.swift +++ b/Sources/tart/Commands/Push.swift @@ -6,7 +6,7 @@ import Compression struct Push: AsyncParsableCommand { static var configuration = CommandConfiguration(abstract: "Push a VM to a registry") - @Argument(help: "local or remote VM name") + @Argument(help: "local or remote VM name", completion: .custom(completeMachines)) var localName: String @Argument(help: "remote VM name(s)") diff --git a/Sources/tart/Commands/Rename.swift b/Sources/tart/Commands/Rename.swift index 1f2c0680..70ae351f 100644 --- a/Sources/tart/Commands/Rename.swift +++ b/Sources/tart/Commands/Rename.swift @@ -4,7 +4,7 @@ import Foundation struct Rename: AsyncParsableCommand { static var configuration = CommandConfiguration(abstract: "Rename a VM") - @Argument(help: "VM name") + @Argument(help: "VM name", completion: .custom(completeLocalMachines)) var name: String @Argument(help: "new VM name") diff --git a/Sources/tart/Commands/Set.swift b/Sources/tart/Commands/Set.swift index 0f69abc2..bfaceee4 100644 --- a/Sources/tart/Commands/Set.swift +++ b/Sources/tart/Commands/Set.swift @@ -4,7 +4,7 @@ import Foundation struct Set: AsyncParsableCommand { static var configuration = CommandConfiguration(commandName: "set", abstract: "Modify VM's configuration") - @Argument(help: "VM name") + @Argument(help: "VM name", completion: .custom(completeLocalMachines)) var name: String @Option(help: "Number of VM CPUs") diff --git a/Sources/tart/Commands/Stop.swift b/Sources/tart/Commands/Stop.swift index 7f46f4ed..0cc83216 100644 --- a/Sources/tart/Commands/Stop.swift +++ b/Sources/tart/Commands/Stop.swift @@ -6,7 +6,7 @@ import SwiftDate struct Stop: AsyncParsableCommand { static var configuration = CommandConfiguration(commandName: "stop", abstract: "Stop a VM") - @Argument(help: "VM name", completion: .custom(completeLocalMachines)) + @Argument(help: "VM name", completion: .custom(completeRunningMachines)) var name: String @Option(name: [.short, .long], help: "Seconds to wait for graceful termination before forcefully terminating the VM")