@@ -68,6 +68,8 @@ func main() {
6868 boldRed ("error: The currency %s in <target_currency> is not supported\n " , targetCurrency )
6969 return
7070 }
71+ // TODO: 만약, usdx krws 이렇게 입력시, 두 에러 메시지가 동시에 발생한다.
72+ // TODO: 이럴 경우, 둘 다 보여줘야 하는가? 아니면, 점층적으로 에러를 반환하게 해야 하는가? 에러의 위게를 어떻게 설정할 것인가?
7173
7274 // amount: string -> positive int 변환
7375 // 참고로, amount가 0이면 의미가 없으므로 종료해야 함.
@@ -79,9 +81,9 @@ func main() {
7981
8082 // main logic
8183 switch targetCurrency {
82- case "USD" , "usd" :
84+ case "USD" , "usd" , "$" :
8385 switch sourceCurrency {
84- case "KRW" , "krw" :
86+ case "KRW" , "krw" , "₩" :
8587 rate := 1 / ExchangeRates ["USD_KRW" ]
8688 time := ExchangeRatesLastUpdated ["USD_KRW" ].Format ("2006-01-02" )
8789 if isFlag {
@@ -95,9 +97,9 @@ func main() {
9597 default :
9698 boldRed ("error: The currencies of <source_currency> and <target_currency> must be different\n " )
9799 }
98- case "KRW" , "krw" :
100+ case "KRW" , "krw" , "₩" :
99101 switch sourceCurrency {
100- case "USD" , "usd" :
102+ case "USD" , "usd" , "$" :
101103 rate := ExchangeRates ["USD_KRW" ]
102104 time := ExchangeRatesLastUpdated ["USD_KRW" ].Format ("2006-01-02" )
103105 if isFlag {
@@ -178,10 +180,10 @@ func main() {
178180 var fromCPI float64
179181 var toCPI float64
180182 switch currency {
181- case "KRW" , "krw" :
183+ case "KRW" , "krw" , "₩" :
182184 fromCPI = KrwCpiData [startYear ]
183185 toCPI = KrwCpiData [endYear ]
184- case "USD" , "usd" :
186+ case "USD" , "usd" , "$" :
185187 fromCPI = UsdCpiData [startYear ]
186188 toCPI = UsdCpiData [endYear ]
187189 }
0 commit comments