Implemented the creation of a root folder within the Create command in the executable target.
This commit is contained in:
parent
6bf9c30ad1
commit
cbd3789ca7
@ -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]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -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) }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user