File tree Expand file tree Collapse file tree 2 files changed +24
-22
lines changed Expand file tree Collapse file tree 2 files changed +24
-22
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import ArgumentParser
22import Figlet
33import Foundation
44
5- let VERSION = " 0.1.0 "
5+ let VERSION = " 0.1.1 "
66
77struct KeyValueOption : ExpressibleByArgument {
88 let key : String
@@ -98,11 +98,14 @@ struct JsonScripts: ParsableCommand {
9898 commandStr = definition. replaceVars ( commandStr, variables: vars)
9999
100100 if !arguments. isEmpty {
101- var joinedArgs = arguments. joined ( separator: " " )
102-
103- if joinedArgs. hasPrefix ( " { " ) && joinedArgs. hasSuffix ( " } " ) || joinedArgs. hasPrefix ( " [ " ) && joinedArgs. hasSuffix ( " ] " ) {
104- joinedArgs = " ' \( joinedArgs) ' "
105- }
101+ let joinedArgs = arguments. map ( { arg in
102+ if arg. hasPrefix ( " { " ) && arg. hasSuffix ( " } " )
103+ || arg. hasPrefix ( " [ " ) && arg. hasSuffix ( " ] " )
104+ {
105+ return " ' \( arg) ' "
106+ }
107+ return arg
108+ } ) . joined ( separator: " " )
106109
107110 commandStr += " " + joinedArgs
108111 }
Original file line number Diff line number Diff line change @@ -45,21 +45,20 @@ func shellProcess(_ commandStr: String) throws {
4545}
4646
4747func bashEscape( _ input: String ) -> String {
48- var escaped = " "
49- for char in input {
50- switch char {
51- case " \\ " :
52- escaped. append ( " \\ \\ " )
53- case " \" " :
54- escaped. append ( " \\ \" " )
55- case " $ " :
56- escaped. append ( " \\ $ " )
57- case " ` " :
58- escaped. append ( " \\ ` " )
59- default :
60- escaped. append ( char)
61- }
48+ var escaped = " "
49+ for char in input {
50+ switch char {
51+ case " \\ " :
52+ escaped. append ( " \\ \\ " )
53+ case " \" " :
54+ escaped. append ( " \\ \" " )
55+ case " $ " :
56+ escaped. append ( " \\ $ " )
57+ case " ` " :
58+ escaped. append ( " \\ ` " )
59+ default :
60+ escaped. append ( char)
6261 }
63- return escaped
62+ }
63+ return escaped
6464}
65-
You can’t perform that action at this time.
0 commit comments