@@ -29,53 +29,35 @@ import Foundation
2929
3030let commandLineInterface = CLIArguments ( )
3131let cpInterface = CommitPrefix . interface ( )
32-
33- do {
3432
35- switch try commandLineInterface. getCommand ( ) {
36-
37- case . outputVersion:
38- let versionOutput = cpInterface. outputVersion ( )
39- Consler . output ( versionOutput)
40-
41- case . viewState:
42- let viewStateOutput = try cpInterface. viewState ( )
43- Consler . output ( viewStateOutput)
44-
45- case . outputPrefixes:
46- let prefixesOutput = try cpInterface. outputPrefixes ( )
47- Consler . output ( prefixesOutput)
48-
49- case . deletePrefixes:
50- let deletionOutput = try cpInterface. deletePrefixes ( )
51- Consler . output ( deletionOutput)
33+ switch commandLineInterface. command {
34+
35+ case . outputVersion:
36+ let versionOutput = cpInterface. outputVersion ( )
37+ Consler . output ( versionOutput)
5238
53- case . modeNormal:
54- let normalModeOutput = try cpInterface. activateNormalMode ( )
55- Consler . output ( normalModeOutput)
56-
57- case . modeBranchParse( validator: let rawValidatorValue) :
58- let branchModeOutput = try cpInterface. activateBranchMode ( with: rawValidatorValue)
59- Consler . output ( branchModeOutput)
60-
61- case . newPrefixes( value: let rawPrefixValue) :
62- let newPrefixesOutput = try cpInterface. writeNew ( prefixes: rawPrefixValue)
63- Consler . output ( newPrefixesOutput)
64-
65- }
39+ case . viewState:
40+ let viewStateOutput = cpInterface. viewState ( )
41+ Consler . output ( viewStateOutput)
6642
67- } catch let prefixError as CPError {
43+ case . outputPrefixes:
44+ let prefixesOutput = cpInterface. outputPrefixes ( )
45+ Consler . output ( prefixesOutput)
6846
69- Consler . output ( prefixError. message , type: . error)
70- exit ( prefixError. status. value)
47+ case . deletePrefixes:
48+ let deletionOutput = cpInterface. deletePrefixes ( )
49+ Consler . output ( deletionOutput)
7150
72- } catch {
51+ case . modeNormal:
52+ let normalModeOutput = cpInterface. activateNormalMode ( )
53+ Consler . output ( normalModeOutput)
7354
74- Consler . output (
75- " Unexpected Error: " , error. localizedDescription,
76- descriptors: [ . boldRed, . normal] ,
77- type: . error)
55+ case . modeBranchParse( validator: let rawValidatorValue) :
56+ let branchModeOutput = cpInterface. activateBranchMode ( with: rawValidatorValue)
57+ Consler . output ( branchModeOutput)
7858
79- exit ( TerminationStatus . unexpectedError. value)
59+ case . newPrefixes( value: let rawPrefixValue) :
60+ let newPrefixesOutput = cpInterface. writeNew ( prefixes: rawPrefixValue)
61+ Consler . output ( newPrefixesOutput)
8062
8163}
0 commit comments