Implemented the creation of a root folder within the Create command in the executable target.
This commit is contained in:
parent
6bf9c30ad1
commit
c1b3fb50a3
@ -6,7 +6,7 @@ struct Colibri: AsyncParsableCommand {
|
||||
// MARK: Properties
|
||||
|
||||
static let configuration = CommandConfiguration(
|
||||
abstract: "The utility to manage your Hummingbird projects",
|
||||
abstract: "The utility to manage your Hummingbird apps",
|
||||
subcommands: [Create.self]
|
||||
)
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import ArgumentParser
|
||||
import ColibriLibrary
|
||||
import Foundation
|
||||
|
||||
extension Colibri {
|
||||
struct Create: AsyncParsableCommand {
|
||||
@ -7,18 +8,24 @@ extension Colibri {
|
||||
// MARK: Properties
|
||||
|
||||
static let configuration = CommandConfiguration(
|
||||
commandName: "create project",
|
||||
abstract: "Create a new, tailored Colibri project.",
|
||||
commandName: "create-project",
|
||||
abstract: "Create a new, tailored Hummingbird app",
|
||||
helpNames: .shortAndLong,
|
||||
aliases: ["create"]
|
||||
)
|
||||
|
||||
@OptionGroup var options: Options
|
||||
|
||||
|
||||
// MARK: Functions
|
||||
|
||||
mutating func run() async throws {
|
||||
|
||||
let fileService = FileService()
|
||||
let createRootFolder = CreateRootFolderTask(fileService: fileService)
|
||||
|
||||
let rootFolder = try await createRootFolder(name: options.name,
|
||||
at: options.locationURL)
|
||||
|
||||
print(rootFolder)
|
||||
}
|
||||
|
||||
}
|
||||
@ -36,6 +43,12 @@ extension Colibri.Create {
|
||||
|
||||
@Option(name: .shortAndLong)
|
||||
var location: String?
|
||||
|
||||
// MARK: Computed
|
||||
|
||||
var locationURL: URL? {
|
||||
location.flatMap { URL(fileURLWithPath: $0) }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user