Skip to content

Commit

Permalink
first update
Browse files Browse the repository at this point in the history
  • Loading branch information
underthestars-zhy committed Jun 3, 2023
1 parent d9e7c90 commit 01f05f2
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 1 deletion.
48 changes: 48 additions & 0 deletions SwiftGGFormatter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

/* Begin PBXBuildFile section */
90B11FF32A2B8CDA00188D29 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90B11FF22A2B8CDA00188D29 /* main.swift */; };
90B11FFB2A2B8CFA00188D29 /* SwiftGGFormater in Frameworks */ = {isa = PBXBuildFile; productRef = 90B11FFA2A2B8CFA00188D29 /* SwiftGGFormater */; };
90B11FFD2A2B8D0600188D29 /* Mapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90B11FFC2A2B8D0600188D29 /* Mapper.swift */; };
90B120002A2B8EB200188D29 /* ArgumentParser in Frameworks */ = {isa = PBXBuildFile; productRef = 90B11FFF2A2B8EB200188D29 /* ArgumentParser */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -25,13 +28,16 @@
/* Begin PBXFileReference section */
90B11FEF2A2B8CDA00188D29 /* SwiftGGFormatter */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SwiftGGFormatter; sourceTree = BUILT_PRODUCTS_DIR; };
90B11FF22A2B8CDA00188D29 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
90B11FFC2A2B8D0600188D29 /* Mapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Mapper.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
90B11FEC2A2B8CDA00188D29 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
90B120002A2B8EB200188D29 /* ArgumentParser in Frameworks */,
90B11FFB2A2B8CFA00188D29 /* SwiftGGFormater in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -58,6 +64,7 @@
isa = PBXGroup;
children = (
90B11FF22A2B8CDA00188D29 /* main.swift */,
90B11FFC2A2B8D0600188D29 /* Mapper.swift */,
);
path = SwiftGGFormatter;
sourceTree = "<group>";
Expand All @@ -78,6 +85,10 @@
dependencies = (
);
name = SwiftGGFormatter;
packageProductDependencies = (
90B11FFA2A2B8CFA00188D29 /* SwiftGGFormater */,
90B11FFF2A2B8EB200188D29 /* ArgumentParser */,
);
productName = SwiftGGFormatter;
productReference = 90B11FEF2A2B8CDA00188D29 /* SwiftGGFormatter */;
productType = "com.apple.product-type.tool";
Expand Down Expand Up @@ -106,6 +117,10 @@
Base,
);
mainGroup = 90B11FE62A2B8CDA00188D29;
packageReferences = (
90B11FF92A2B8CFA00188D29 /* XCRemoteSwiftPackageReference "SwiftGGFormater" */,
90B11FFE2A2B8EB200188D29 /* XCRemoteSwiftPackageReference "swift-argument-parser" */,
);
productRefGroup = 90B11FF02A2B8CDA00188D29 /* Products */;
projectDirPath = "";
projectRoot = "";
Expand All @@ -120,6 +135,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
90B11FFD2A2B8D0600188D29 /* Mapper.swift in Sources */,
90B11FF32A2B8CDA00188D29 /* main.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -284,6 +300,38 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
90B11FF92A2B8CFA00188D29 /* XCRemoteSwiftPackageReference "SwiftGGFormater" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/underthestars-zhy/SwiftGGFormater";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
};
};
90B11FFE2A2B8EB200188D29 /* XCRemoteSwiftPackageReference "swift-argument-parser" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/apple/swift-argument-parser.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
90B11FFA2A2B8CFA00188D29 /* SwiftGGFormater */ = {
isa = XCSwiftPackageProductDependency;
package = 90B11FF92A2B8CFA00188D29 /* XCRemoteSwiftPackageReference "SwiftGGFormater" */;
productName = SwiftGGFormater;
};
90B11FFF2A2B8EB200188D29 /* ArgumentParser */ = {
isa = XCSwiftPackageProductDependency;
package = 90B11FFE2A2B8EB200188D29 /* XCRemoteSwiftPackageReference "swift-argument-parser" */;
productName = ArgumentParser;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 90B11FE72A2B8CDA00188D29 /* Project object */;
}
32 changes: 32 additions & 0 deletions SwiftGGFormatter/Mapper.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// Mapper.swift
// SwiftGGFormatter
//
// Created by 朱浩宇 on 2023/6/3.
//

import Foundation

let mapper = [
"adjusting-the-space-between-views.yml": "https://developer.apple.com/tutorials/swiftui-concepts/adjusting-the-space-between-views",

"choosing-the-right-way-to-hide-a-view.yml": "https://developer.apple.com/tutorials/swiftui-concepts/choosing-the-right-way-to-hide-a-view",

"creating-a-custom-input-control-that-binds-to-a-value.yml": "https://developer.apple.com/tutorials/swiftui-concepts/creating-a-custom-input-control-that-binds-to-a-value",

"defining-the-source-of-truth-using-a-custom-binding.yml": "https://developer.apple.com/tutorials/swiftui-concepts/defining-the-source-of-truth-using-a-custom-binding",

"driving-changes-in-your-ui-with-state-and-bindings.yml": "https://developer.apple.com/tutorials/swiftui-concepts/driving-changes-in-your-ui-with-state-and-bindings",

"exploring-the-structure-of-a-swiftui-app.yml": "https://developer.apple.com/tutorials/swiftui-concepts/exploring-the-structure-of-a-swiftui-app",

"layering-content.yml": "https://developer.apple.com/tutorials/swiftui-concepts/layering-content",

"maintaining-the-adaptable-sizes-of-built-in-views.yml": "https://developer.apple.com/tutorials/swiftui-concepts/maintaining-the-adaptable-sizes-of-built-in-views",

"organizing-and-aligning-content-with-stacks.yml": "https://developer.apple.com/tutorials/swiftui-concepts/organizing-and-aligning-content-with-stacks",

"scaling-views-to-complement-text.yml": "https://developer.apple.com/tutorials/swiftui-concepts/scaling-views-to-complement-text",

"specifying-the-view-hierarchy-of-an-app-using-a-scene.yml": "https://developer.apple.com/tutorials/swiftui-concepts/specifying-the-view-hierarchy-of-an-app-using-a-scene",
]
12 changes: 11 additions & 1 deletion SwiftGGFormatter/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
//

import Foundation
import SwiftGGFormater
import ArgumentParser

print("Hello, World!")
struct SwiftGGFormatterCLI: ParsableCommand {
@Argument(help: "TPlease provide the file path of the text you want to reorder.")
var path: String

mutating func run() async throws {
let file = URL.init(filePath: path)
let formater = SwiftGGFormater(file: file, web: URL(string: mapper[file.lastPathComponent]!)!)
try await formater.formate()
}
}

0 comments on commit 01f05f2

Please sign in to comment.