Template support for input parameters #4

Merged
javier merged 81 commits from feature/arguments-templating into main 2025-02-17 22:11:06 +00:00
2 changed files with 20 additions and 5 deletions
Showing only changes of commit cbd3789ca7 - Show all commits

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,18 +8,26 @@ 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 +45,12 @@ extension Colibri.Create {
@Option(name: .shortAndLong)
var location: String?
// MARK: Computed
var locationURL: URL? {
location.flatMap { URL(fileURLWithPath: $0) }
}
}
}