sirin05137 / CSE364_Project

2 stars 0 forks source link

Java Command Line Argument #11

Closed yuujinleee closed 3 years ago

yuujinleee commented 3 years ago

이슈에 연결된 커밋에 적용된 사항들 :

a) 현재 따로 input 받는 부분을 command line argument에서 처리하도록 하고 b) 에러메시지 포맷 맞추고 에러 발생 시 바로 System exit (+Occupation 해당 인풋 없음 에러) c) Occupation switch문에서 인풋 띄어쓰기 모두 제거

[ENG] On the linked commit, a) I enabled getting inputs from command line argument b) Changed the form of error messages && System.exit on errors c) Removed " " on occupation input switch

링크 클릭 시 변경사항 확인 가능 ➡️ sirin05137/CSE364_Project@1517254

Command line argument 처리 + Error message 예시

1) input 0개

: java -cp target/cse364-project-1.0-SNAPSHOT.jar group11.project

yujinlee@Yujins-MacBook-Pro CSE364_Project % java -cp target/cse364-project-1.0-SNAPSHOT.jar group11.project                                

INPUT_ERROR: 2 arguments needed (inputStr1 inputStr2)

2) Occupation input 없음 에러 : drama drama

yujinlee@Yujins-MacBook-Pro CSE364_Project % java -cp target/cse364-project-1.0-SNAPSHOT.jar group11.project drama drama

INPUT_ERROR: Entered occupation doesn't exist

3) input 3개 : drama scientist scientist

yujinlee@Yujins-MacBook-Pro CSE364_Project % java -cp target/cse364-project-1.0-SNAPSHOT.jar group11.project drama scientist scientist

INPUT_ERROR: 2 arguments needed (inputStr1 inputStr2)

4) 유효한 input : drama scientist

yujinlee@Yujins-MacBook-Pro CSE364_Project % java -cp target/cse364-project-1.0-SNAPSHOT.jar group11.project drama scientist          

The rating of drama rated by scientist : 3.84%                                                                                                                                           

5) Pipeline error

파이프라인("|")을 Shell command 로 인식하기 때문에, 앞에 backslash("\")를 붙여주어야만 유효한 인풋으로 처리

Wrong input : drama|horror scientist

yujinlee@Yujins-MacBook-Pro CSE364_Project % java -cp target/cse364-project-1.0-SNAPSHOT.jar group11.project drama|horror scientist
zsh: command not found: horror

Correct input : drama\|horror scientist

yujinlee@Yujins-MacBook-Pro CSE364_Project % java -cp target/cse364-project-1.0-SNAPSHOT.jar group11.project drama\|horror scientist

The rating of drama|horror rated by scientist : 3.42%                                                                                                                                    

6) Error message 약간 수정(포맷 맞춤)

yujinlee@Yujins-MacBook-Pro CSE364_Project % java -cp target/cse364-project-1.0-SNAPSHOT.jar group11.project drama\|comedy\|horror scientist

INPUT_ERROR: Movie for the entered genre(s) doesn't exist