Skip to content

Commit e94f38d

Browse files
committed
Init
main
1 parent 4b07557 commit e94f38d

File tree

16 files changed

+575
-36
lines changed

16 files changed

+575
-36
lines changed

.gitignore

Lines changed: 212 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,215 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/xcode,swift,cocoapods,macos
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=xcode,swift,cocoapods,macos
3+
4+
### CocoaPods ###
5+
## CocoaPods GitIgnore Template
6+
7+
# CocoaPods - Only use to conserve bandwidth / Save time on Pushing
8+
# - Also handy if you have a large number of dependant pods
9+
# - AS PER https://guides.cocoapods.org/using/using-cocoapods.html NEVER IGNORE THE LOCK FILE
10+
Pods/
11+
12+
### macOS ###
13+
# General
114
.DS_Store
2-
/.build
3-
/Packages
4-
/*.xcodeproj
15+
.AppleDouble
16+
.LSOverride
17+
18+
# Icon must end with two \r
19+
Icon
20+
21+
22+
# Thumbnails
23+
._*
24+
25+
# Files that might appear in the root of a volume
26+
.DocumentRevisions-V100
27+
.fseventsd
28+
.Spotlight-V100
29+
.TemporaryItems
30+
.Trashes
31+
.VolumeIcon.icns
32+
.com.apple.timemachine.donotpresent
33+
34+
# Directories potentially created on remote AFP share
35+
.AppleDB
36+
.AppleDesktop
37+
Network Trash Folder
38+
Temporary Items
39+
.apdisk
40+
41+
### Swift ###
42+
# Xcode
43+
#
44+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
45+
46+
## User settings
547
xcuserdata/
48+
49+
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
50+
*.xcscmblueprint
51+
*.xccheckout
52+
53+
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
54+
build/
655
DerivedData/
7-
.swiftpm/config/registries.json
8-
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
9-
.netrc
56+
*.moved-aside
57+
*.pbxuser
58+
!default.pbxuser
59+
*.mode1v3
60+
!default.mode1v3
61+
*.mode2v3
62+
!default.mode2v3
63+
*.perspectivev3
64+
!default.perspectivev3
65+
66+
## Obj-C/Swift specific
67+
*.hmap
68+
69+
## App packaging
70+
*.ipa
71+
*.dSYM.zip
72+
*.dSYM
73+
74+
## Playgrounds
75+
timeline.xctimeline
76+
playground.xcworkspace
77+
78+
# Swift Package Manager
79+
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
80+
# Packages/
81+
# Package.pins
82+
# Package.resolved
83+
# *.xcodeproj
84+
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
85+
# hence it is not needed unless you have added a package configuration file to your project
86+
**/.swiftpm
87+
88+
.build/
89+
90+
# CocoaPods
91+
# We recommend against adding the Pods directory to your .gitignore. However
92+
# you should judge for yourself, the pros and cons are mentioned at:
93+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
94+
# Pods/
95+
# Add this line if you want to avoid checking in source code from the Xcode workspace
96+
# *.xcworkspace
97+
98+
# Carthage
99+
# Add this line if you want to avoid checking in source code from Carthage dependencies.
100+
# Carthage/Checkouts
101+
102+
Carthage/Build/
103+
104+
# Accio dependency management
105+
Dependencies/
106+
.accio/
107+
108+
# fastlane
109+
# It is recommended to not store the screenshots in the git repo.
110+
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
111+
# For more information about the recommended setup visit:
112+
# https://docs.fastlane.tools/best-practices/source-control/#source-control
113+
114+
fastlane/report.xml
115+
fastlane/Preview.html
116+
fastlane/screenshots/**/*.png
117+
fastlane/test_output
118+
119+
# Code Injection
120+
# After new code Injection tools there's a generated folder /iOSInjectionProject
121+
# https://github.com/johnno1962/injectionforxcode
122+
123+
iOSInjectionProject/
124+
125+
### Xcode ###
126+
# Xcode
127+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
128+
129+
130+
131+
132+
## Gcc Patch
133+
/*.gcno
134+
135+
### Xcode Patch ###
136+
*.xcodeproj/*
137+
!*.xcodeproj/project.pbxproj
138+
!*.xcodeproj/xcshareddata/
139+
!*.xcworkspace/contents.xcworkspacedata
140+
**/xcshareddata/WorkspaceSettings.xcsettings
141+
142+
# End of https://www.toptal.com/developers/gitignore/api/xcode,swift,cocoapods,macos
143+
144+
**/output
145+
146+
**/sonarqube-generic-coverage.xml
147+
148+
**/test_output/**/*
149+
150+
151+
## Tuist
152+
153+
### macOS ###
154+
# General
155+
.DS_Store
156+
.AppleDouble
157+
.LSOverride
158+
159+
# Icon must end with two
160+
Icon
161+
162+
# Thumbnails
163+
._*
164+
165+
# Files that might appear in the root of a volume
166+
.DocumentRevisions-V100
167+
.fseventsd
168+
.Spotlight-V100
169+
.TemporaryItems
170+
.Trashes
171+
.VolumeIcon.icns
172+
.com.apple.timemachine.donotpresent
173+
174+
# Directories potentially created on remote AFP share
175+
.AppleDB
176+
.AppleDesktop
177+
Network Trash Folder
178+
Temporary Items
179+
.apdisk
180+
181+
### Xcode ###
182+
# Xcode
183+
#
184+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
185+
186+
## User settings
187+
xcuserdata/
188+
189+
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
190+
*.xcscmblueprint
191+
*.xccheckout
192+
193+
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
194+
build/
195+
DerivedData/
196+
*.moved-aside
197+
*.pbxuser
198+
!default.pbxuser
199+
*.mode1v3
200+
!default.mode1v3
201+
*.mode2v3
202+
!default.mode2v3
203+
*.perspectivev3
204+
!default.perspectivev3
205+
206+
### Xcode Patch ###
207+
*.xcodeproj/*
208+
!*.xcodeproj/project.pbxproj
209+
!*.xcodeproj/xcshareddata/
210+
!*.xcworkspace/contents.xcworkspacedata
211+
/*.gcno
212+
213+
### Projects ###
214+
*.xcodeproj
215+
*.xcworkspace

.swiftformat

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--extensionacl on-declarations
2+
--redundanttype explicit
3+
--swiftversion 5.7
4+
--maxwidth 120
5+
--header "{file}\nArgumentEncoding\n\nCopyright © {year} MFB Technologies, Inc. All rights reserved."
6+
--allman false
7+
--exclude **/output/**/*,.tuist-bin,**/.swiftpm/*,**/.build/*
8+
--wraparguments before-first
9+
--wrapcollections before-first

.swiftlint.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
disabled_rules:
2+
- multiple_closures_with_trailing_closure # by SwiftUI
3+
- trailing_comma # conflicts with SwiftFormat
4+
- opening_brace # conflicts with SwiftFormat
5+
excluded: # paths to ignore during linting. Takes precedence over `included`.
6+
- ./**/.build/*
7+
- ./**/.swiftpm/*
8+
- ./**/output/*
9+
- ./**/Tests/*
10+
- ./**/Previews/*
11+
- Tuist
12+
- .tuist-bin
13+
identifier_name:
14+
allowed_symbols: "_"
15+
excluded: # excluded via string array
16+
- id
17+
- to
18+
- vm
19+
- vc
20+
- _min
21+
- _max
22+
- or
23+
- by
24+
type_name:
25+
allowed_symbols: "_"
26+
excluded:
27+
- ID
28+
- Id

Package.resolved

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,41 @@
11
// swift-tools-version: 5.7
2-
// The swift-tools-version declares the minimum version of Swift required to build this package.
32

43
import PackageDescription
54

65
let package = Package(
76
name: "swift-argument-encoding",
7+
platforms: [.macOS(.v10_15)],
88
products: [
9-
// Products define the executables and libraries a package produces, and make them visible to other packages.
10-
.library(
11-
name: "swift-argument-encoding",
12-
targets: ["swift-argument-encoding"]),
9+
.library(name: "ArgumentEncoding", targets: ["ArgumentEncoding"]),
1310
],
1411
dependencies: [
15-
// Dependencies declare other packages that this package depends on.
16-
// .package(url: /* package url */, from: "1.0.0"),
12+
.dependencies,
1713
],
1814
targets: [
19-
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
20-
// Targets can depend on other targets in this package, and on products in packages this package depends on.
2115
.target(
22-
name: "swift-argument-encoding",
23-
dependencies: []),
16+
name: "ArgumentEncoding",
17+
dependencies: [
18+
.dependencies,
19+
]
20+
),
2421
.testTarget(
25-
name: "swift-argument-encodingTests",
26-
dependencies: ["swift-argument-encoding"]),
22+
name: "ArgumentEncodingTests",
23+
dependencies: [
24+
"ArgumentEncoding",
25+
]
26+
),
2727
]
2828
)
29+
30+
// MARK: PointFree
31+
32+
extension Package.Dependency {
33+
static let dependencies: Package.Dependency = .package(
34+
url: "https://github.com/pointfreeco/swift-dependencies.git",
35+
.upToNextMajor(from: "0.1.1")
36+
)
37+
}
38+
39+
extension Target.Dependency {
40+
static let dependencies: Self = .product(name: "Dependencies", package: "swift-dependencies")
41+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// ArgumentRepresentable.swift
2+
// ArgumentEncoding
3+
//
4+
// Copyright © 2023 MFB Technologies, Inc. All rights reserved.
5+
6+
public protocol ArgumentRepresentable {
7+
func arguments() -> [String]
8+
}
9+
10+
extension ArgumentRepresentable {
11+
public func arguments() -> [String] {
12+
childArguments()
13+
}
14+
15+
func childArguments() -> [String] {
16+
let mirror = Mirror(reflecting: self)
17+
return mirror.children.flatMap { child in
18+
if let command = child as? Command {
19+
return command.arguments()
20+
} else if let flag = child as? Flag {
21+
return flag.arguments()
22+
} else if let option = child as? Option {
23+
return option.arguments()
24+
} else {
25+
return []
26+
}
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)