Skip to content

Commit

Permalink
Merge branch 'main' into cli
Browse files Browse the repository at this point in the history
  • Loading branch information
omochi committed Dec 19, 2022
2 parents a36115a + 3391b00 commit 5c2b045
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 28 deletions.
9 changes: 0 additions & 9 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"pins" : [
{
"identity" : "codetemplate",
"kind" : "remoteSourceControl",
"location" : "https://github.com/omochi/CodeTemplate",
"state" : {
"revision" : "45cadb9129eb712b9fbf808fcb2d3e8575a07b13",
"version" : "1.0.2"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ let package = Package(
.library(name: "CodeTemplateModule", targets: ["CodeTemplateModule"]),
],
dependencies: [
.package(url: "https://github.com/omochi/CodeTemplate", from: "1.0.2"),
.package(url: "https://github.com/apple/swift-format", exact: "0.50700.1"),
.package(url: "https://github.com/apple/swift-syntax", exact: "0.50700.1"),
.package(url: "https://github.com/apple/swift-syntax", exact: "0.50700.1")
],
targets: [
.target(
Expand All @@ -34,7 +33,8 @@ let package = Package(
name: "CodegenKitCLI",
dependencies: [
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftFormat", package: "swift-format")
.product(name: "SwiftFormat", package: "swift-format"),
.target(name: "CodegenKit")
]
),
.testTarget(
Expand Down
29 changes: 29 additions & 0 deletions Sources/CodegenKitCLI/ManifestoInitializer.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Foundation
import SwiftSyntax
import SwiftSyntaxParser
import CodegenKit

public struct ManifestoInitializer {
public init(directory: URL) {
self.directory = directory
self.fileManager = .default
}

public var directory: URL
private let fileManager: FileManager

public func run() throws {
guard fileManager.directoryExists(atPath: directory.path) else {
throw MessageError("no directory: \(directory.relativePath)")
}

let manifestoFile = directory.appendingPathComponent("Package.swift")
guard fileManager.fileExists(atPath: manifestoFile.path) else {
throw MessageError("no manifesto file: \(manifestoFile.relativePath)")
}

let manifestoSyntax = try SyntaxParser.parse(manifestoFile)

print(manifestoSyntax)
}
}
16 changes: 0 additions & 16 deletions Sources/CodegenKitCLI/PackageInitCommand.swift

This file was deleted.

0 comments on commit 5c2b045

Please sign in to comment.