Implemented the creation of a root folder within the Create command in the executable target.

This commit is contained in:
Javier Cicchelli 2025-01-12 02:41:17 +01:00
parent 6bf9c30ad1
commit cbd3789ca7
2 changed files with 20 additions and 5 deletions

View File

@ -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]
)

View File

@ -1,5 +1,6 @@
import ArgumentParser
import ColibriLibrary
import Foundation
extension Colibri {
struct Create: AsyncParsableCommand {
@ -7,8 +8,8 @@ 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"]
)
@ -18,7 +19,15 @@ extension Colibri {
// 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)
}
}
@ -37,5 +46,11 @@ extension Colibri.Create {
@Option(name: .shortAndLong)
var location: String?
// MARK: Computed
var locationURL: URL? {
location.flatMap { URL(fileURLWithPath: $0) }
}
}
}