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 // MARK: Properties
static let configuration = CommandConfiguration( static let configuration = CommandConfiguration(
abstract: "The utility to manage your Hummingbird projects", abstract: "The utility to manage your Hummingbird apps",
subcommands: [Create.self] subcommands: [Create.self]
) )

View File

@ -1,5 +1,6 @@
import ArgumentParser import ArgumentParser
import ColibriLibrary import ColibriLibrary
import Foundation
extension Colibri { extension Colibri {
struct Create: AsyncParsableCommand { struct Create: AsyncParsableCommand {
@ -7,18 +8,26 @@ extension Colibri {
// MARK: Properties // MARK: Properties
static let configuration = CommandConfiguration( static let configuration = CommandConfiguration(
commandName: "create project", commandName: "create-project",
abstract: "Create a new, tailored Colibri project.", abstract: "Create a new, tailored Hummingbird app",
helpNames: .shortAndLong, helpNames: .shortAndLong,
aliases: ["create"] aliases: ["create"]
) )
@OptionGroup var options: Options @OptionGroup var options: Options
// MARK: Functions // MARK: Functions
mutating func run() async throws { 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) @Option(name: .shortAndLong)
var location: String? var location: String?
// MARK: Computed
var locationURL: URL? {
location.flatMap { URL(fileURLWithPath: $0) }
}
} }
} }