cli: Add Initial Cli Work
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
This commit is contained in:
+10
-1
@@ -1,6 +1,15 @@
|
||||
{
|
||||
"originHash" : "3969417c2a67000e225174da55741dc4261b615b990ae4ce381417f06c5e9099",
|
||||
"originHash" : "5d36627594955e7c1e9d5ca6b02c23ee9dc8e0d4ce73dc310b34fa6d1b966434",
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "swift-argument-parser",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-argument-parser",
|
||||
"state" : {
|
||||
"revision" : "626b5b7b2f45e1b0b1c6f4a309296d1d21d7311b",
|
||||
"version" : "1.7.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"identity" : "swift-docc-plugin",
|
||||
"kind" : "remoteSourceControl",
|
||||
|
||||
+17
-2
@@ -5,7 +5,7 @@ import CompilerPluginSupport
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "p4rse",
|
||||
name: "p4ce",
|
||||
platforms: [.iOS(.v17), .macOS(.v13)],
|
||||
products: [
|
||||
// Products define the executables and libraries a package produces, making them visible to other packages.
|
||||
@@ -25,12 +25,17 @@ let package = Package(
|
||||
name: "P4Runtime",
|
||||
targets: ["P4Runtime"]
|
||||
),
|
||||
.executable(
|
||||
name: "p4ce",
|
||||
targets: ["Cli"]
|
||||
),
|
||||
],
|
||||
dependencies: [
|
||||
.package(path: "./tree-sitter-p4"),
|
||||
.package(url: "https://github.com/tree-sitter/swift-tree-sitter", revision: "main"),
|
||||
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
|
||||
.package(url: "https://github.com/swiftlang/swift-syntax", from: "602.0.0"),
|
||||
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"),
|
||||
],
|
||||
targets: [
|
||||
.macro(
|
||||
@@ -73,9 +78,19 @@ let package = Package(
|
||||
name: "P4Runtime",
|
||||
dependencies: ["P4Lang", "Common"]
|
||||
),
|
||||
.executableTarget(
|
||||
name: "Cli",
|
||||
dependencies: [
|
||||
"Common", "P4Lang", "P4Compiler", "P4Runtime", "Macros",
|
||||
.product(name: "ArgumentParser", package: "swift-argument-parser"),
|
||||
],
|
||||
swiftSettings: [.enableExperimentalFeature("CodeItemMacros")],
|
||||
),
|
||||
.testTarget(
|
||||
name: "Tests",
|
||||
dependencies: ["P4Compiler", "P4Runtime", "P4Lang", "Macros", "TreeSitterExtensions", "Common"],
|
||||
dependencies: [
|
||||
"P4Compiler", "P4Runtime", "P4Lang", "Macros", "TreeSitterExtensions", "Common",
|
||||
],
|
||||
swiftSettings: [.enableExperimentalFeature("CodeItemMacros")],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -90,6 +90,7 @@ where `<component>` is one of:
|
||||
4. `common`: For any Swift-based components common to the entire project (and macros).
|
||||
5. `documentation`: For any documentation updates.
|
||||
6. `testing`: For Swift-based tests.
|
||||
7. `cli`: For Cli components.
|
||||
|
||||
where `<subcomponent>` can be more free-form and `<change>` is a pithy description of the changes in the commit.
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// p4rse, Copyright 2026, Will Hawkins
|
||||
//
|
||||
// This file is part of p4rse.
|
||||
//
|
||||
// This file is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import ArgumentParser
|
||||
import Darwin
|
||||
import Common
|
||||
@main
|
||||
struct Cli: ParsableCommand {
|
||||
public func run() throws {
|
||||
let e = ErrorWithLocation(sourceLocation: SourceLocation(1, 5), withError: "Testing")
|
||||
print(e.format())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user