Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enclose bash argument values in quotes to allow spaces #1097

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Sources/ApolloCodegenLib/ApolloCodegenOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,20 @@ public struct ApolloCodegenOptions {
"codegen:generate",
"--target=\(self.codegenEngine.targetForApolloTools)",
"--addTypename",
"--includes=\(self.includes)",
"--localSchemaFile=\(self.urlToSchemaFile.path)"
"--includes='\(self.includes)'",
"--localSchemaFile='\(self.urlToSchemaFile.path)'"
]

if let namespace = self.namespace {
arguments.append("--namespace=\(namespace)")
}

if let only = only {
arguments.append("--only=\(only.path)")
arguments.append("--only='\(only.path)'")
}

if let idsURL = self.operationIDsURL {
arguments.append("--operationIdsPath=\(idsURL.path)")
arguments.append("--operationIdsPath='\(idsURL.path)'")
}

if self.omitDeprecatedEnumCases {
Expand All @@ -183,9 +183,9 @@ public struct ApolloCodegenOptions {

switch self.outputFormat {
case .singleFile(let fileURL):
arguments.append(fileURL.path)
arguments.append("'\(fileURL.path)'")
case .multipleFiles(let folderURL):
arguments.append(folderURL.path)
arguments.append("'\(folderURL.path)'")
}

return arguments
Expand Down
2 changes: 1 addition & 1 deletion Sources/ApolloCodegenLib/ApolloSchemaOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public struct ApolloSchemaOptions {
// Header argument must be last in the CLI command due to an underlying issue in the Oclif framework.
// See: https://github.com/apollographql/apollo-tooling/issues/844#issuecomment-547143805
if let header = self.header {
arguments.append("--header=\(header)")
arguments.append("--header='\(header)'")
}

return arguments
Expand Down
16 changes: 8 additions & 8 deletions Tests/ApolloCodegenTests/ApolloCodegenTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ class ApolloCodegenTests: XCTestCase {
"codegen:generate",
"--target=swift",
"--addTypename",
"--includes=./**/*.graphql",
"--localSchemaFile=\(schema.path)",
"--includes='./**/*.graphql'",
"--localSchemaFile='\(schema.path)'",
"--mergeInFieldsFromFragmentSpreads",
output.path,
"'\(output.path)'",
])
}

Expand Down Expand Up @@ -97,14 +97,14 @@ class ApolloCodegenTests: XCTestCase {
"codegen:generate",
"--target=json",
"--addTypename",
"--includes=*.graphql",
"--localSchemaFile=\(schema.path)",
"--includes='*.graphql'",
"--localSchemaFile='\(schema.path)'",
"--namespace=\(namespace)",
"--only=\(only.path)",
"--operationIdsPath=\(operationIDsURL.path)",
"--only='\(only.path)'",
"--operationIdsPath='\(operationIDsURL.path)'",
"--omitDeprecatedEnumCases",
"--passthroughCustomScalars",
output.path,
"'\(output.path)'",
])
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/ApolloCodegenTests/ApolloSchemaTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ApolloSchemaTests: XCTestCase {
"--endpoint=http://localhost:8080/graphql",
"--key=\(apiKey)",
"'\(expectedOutputURL.path)'",
"--header=\(header)"
"--header='\(header)'"
])
}

Expand Down