Skip to content

Commit 10b76d6

Browse files
committed
Enclose bash argument values in quotes to allow spaces
1 parent fd70bfd commit 10b76d6

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

Sources/ApolloCodegenLib/ApolloCodegenOptions.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,20 @@ public struct ApolloCodegenOptions {
149149
"codegen:generate",
150150
"--target=\(self.codegenEngine.targetForApolloTools)",
151151
"--addTypename",
152-
"--includes=\(self.includes)",
153-
"--localSchemaFile=\(self.urlToSchemaFile.path)"
152+
"--includes='\(self.includes)'",
153+
"--localSchemaFile='\(self.urlToSchemaFile.path)'"
154154
]
155155

156156
if let namespace = self.namespace {
157157
arguments.append("--namespace=\(namespace)")
158158
}
159159

160160
if let only = only {
161-
arguments.append("--only=\(only.path)")
161+
arguments.append("--only='\(only.path)'")
162162
}
163163

164164
if let idsURL = self.operationIDsURL {
165-
arguments.append("--operationIdsPath=\(idsURL.path)")
165+
arguments.append("--operationIdsPath='\(idsURL.path)'")
166166
}
167167

168168
if self.omitDeprecatedEnumCases {
@@ -183,9 +183,9 @@ public struct ApolloCodegenOptions {
183183

184184
switch self.outputFormat {
185185
case .singleFile(let fileURL):
186-
arguments.append(fileURL.path)
186+
arguments.append("'\(fileURL.path)'")
187187
case .multipleFiles(let folderURL):
188-
arguments.append(folderURL.path)
188+
arguments.append("'\(folderURL.path)'")
189189
}
190190

191191
return arguments

Sources/ApolloCodegenLib/ApolloSchemaOptions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public struct ApolloSchemaOptions {
5656
// Header argument must be last in the CLI command due to an underlying issue in the Oclif framework.
5757
// See: https://github.com/apollographql/apollo-tooling/issues/844#issuecomment-547143805
5858
if let header = self.header {
59-
arguments.append("--header=\(header)")
59+
arguments.append("--header='\(header)'")
6060
}
6161

6262
return arguments

Tests/ApolloCodegenTests/ApolloCodegenTests.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ class ApolloCodegenTests: XCTestCase {
5050
"codegen:generate",
5151
"--target=swift",
5252
"--addTypename",
53-
"--includes=./**/*.graphql",
54-
"--localSchemaFile=\(schema.path)",
53+
"--includes='./**/*.graphql'",
54+
"--localSchemaFile='\(schema.path)'",
5555
"--mergeInFieldsFromFragmentSpreads",
56-
output.path,
56+
"'\(output.path)'",
5757
])
5858
}
5959

@@ -97,14 +97,14 @@ class ApolloCodegenTests: XCTestCase {
9797
"codegen:generate",
9898
"--target=json",
9999
"--addTypename",
100-
"--includes=*.graphql",
101-
"--localSchemaFile=\(schema.path)",
100+
"--includes='*.graphql'",
101+
"--localSchemaFile='\(schema.path)'",
102102
"--namespace=\(namespace)",
103-
"--only=\(only.path)",
104-
"--operationIdsPath=\(operationIDsURL.path)",
103+
"--only='\(only.path)'",
104+
"--operationIdsPath='\(operationIDsURL.path)'",
105105
"--omitDeprecatedEnumCases",
106106
"--passthroughCustomScalars",
107-
output.path,
107+
"'\(output.path)'",
108108
])
109109
}
110110

Tests/ApolloCodegenTests/ApolloSchemaTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class ApolloSchemaTests: XCTestCase {
5454
"--endpoint=http://localhost:8080/graphql",
5555
"--key=\(apiKey)",
5656
"'\(expectedOutputURL.path)'",
57-
"--header=\(header)"
57+
"--header='\(header)'"
5858
])
5959
}
6060

0 commit comments

Comments
 (0)