Skip to content

Commit

Permalink
Introduce "tart fqn" command (#735)
Browse files Browse the repository at this point in the history
* tart pull: experimental --json-digest option

* Introduce "tart fqn" command

* Revert "tart pull: experimental --json-digest option"

This reverts commit 842052f.
  • Loading branch information
edigaryev authored Feb 19, 2024
1 parent 7dcebf9 commit 3f17884
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Sources/tart/Commands/FQN.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import ArgumentParser
import Foundation
import SystemConfiguration

struct FQN: AsyncParsableCommand {
static var configuration = CommandConfiguration(abstract: "Get a fully-qualified VM name", shouldDisplay: false)

@Argument(help: "VM name")
var name: String

func run() async throws {
if var remoteName = try? RemoteName(name) {
let digest = try VMStorageOCI().digest(remoteName)

remoteName.reference = Reference(digest: digest)

print(remoteName)
} else {
print(name)
}
}
}
1 change: 1 addition & 0 deletions Sources/tart/Root.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct Root: AsyncParsableCommand {
Rename.self,
Stop.self,
Delete.self,
FQN.self,
])

public static func main() async throws {
Expand Down

0 comments on commit 3f17884

Please sign in to comment.