@@ -729,9 +729,17 @@ module Init = struct
729729 let man = man " Initialize the configuration file with the server, and \
730730 a token or a nickname+secret pair"
731731
732+ let exits =
733+ let open Cmd.Exit in
734+ [ info ~doc: " Default exit." ok
735+ ; info ~doc: " Input error: unable to find a server URL or connection token." 1
736+ ; info ~doc: " The client's version is incompatible (too old?) w.r.t. the server." 70
737+ ]
738+
732739 let info =
733740 Cmd. info
734741 ~man
742+ ~exits
735743 ~sdocs: Manpage. s_options
736744 ~doc: " Initialize the configuration file."
737745 " init"
@@ -819,9 +827,19 @@ module Grade = struct
819827 " Grades an OCaml exercise using a learn-ocaml server, and submits \
820828 solutions."
821829
830+ let exits =
831+ let open Cmd.Exit in
832+ [ info ~doc: " Default exit." ok
833+ ; info ~doc: " Server-side error: either unable to reach the server or request has been failed." 1
834+ ; info ~doc: " Input error: unable to find a file to grade or token isn't valid." 2
835+ ; info ~doc: " Grading failed." 10
836+ ; info ~doc: " The client's version is incompatible (too old?) w.r.t. the server." 70
837+ ]
838+
822839 let info =
823840 Cmd. info
824841 ~man
842+ ~exits
825843 ~sdocs: Manpage. s_options
826844 ~doc: " Learn-ocaml grading client."
827845 " grade"
@@ -850,7 +868,14 @@ module Print_token = struct
850868
851869 let man = man explanation
852870
853- let info = Cmd. info ~man ~doc: explanation ~sdocs: Manpage. s_options " print-token"
871+ let exits =
872+ let open Cmd.Exit in
873+ [ info ~doc: " Default exit." ok
874+ ; info ~doc: " Server error: could not reach the server or config file wasn't found." 1
875+ ; info ~doc: " The client's version is incompatible (too old?) w.r.t. the server." 70
876+ ]
877+
878+ let info = Cmd. info ~man ~exits ~doc: explanation ~sdocs: Manpage. s_options " print-token"
854879
855880 let term = use_global print_tok
856881end
@@ -865,8 +890,15 @@ module Print_server = struct
865890 let explanation = " Just print the configured server."
866891
867892 let man = man explanation
868-
869- let info = Cmd. info ~man ~doc: explanation ~sdocs: Manpage. s_options " print-server"
893+
894+ let exits =
895+ let open Cmd.Exit in
896+ [ info ~doc: " Default exit." ok
897+ ; info ~doc: " Server error: could not reach the server or config file wasn't found." 1
898+ ; info ~doc: " The client's version is incompatible (too old?) w.r.t. the server." 70
899+ ]
900+
901+ let info = Cmd. info ~man ~exits ~doc: explanation ~sdocs: Manpage. s_options " print-server"
870902
871903 let term = use_global print_server
872904
@@ -948,7 +980,7 @@ module Server_version = struct
948980 let open Cmd.Exit in
949981 [ info ~doc: " Default exit." ok
950982 ; info ~doc: " Unable to reach the server." 1
951- ; info ~doc: " Input error: unable to find a server URL." 2
983+ ; info ~doc: " Input error: unable to find a server URL or config file ." 2
952984 ; info ~doc: " The client's version is incompatible (too old?) w.r.t. the server." 70
953985 ]
954986
@@ -971,9 +1003,17 @@ module Set_options = struct
9711003 " Overwrite the configuration file with the command-line options \
9721004 ($(b,--server), $(b,--token))."
9731005
1006+ let exits =
1007+ let open Cmd.Exit in
1008+ [ info ~doc: " Default exit." ok
1009+ ; info ~doc: " Server error: config file wasn't found." 1
1010+ ; info ~doc: " The client's version is incompatible (too old?) w.r.t. the server." 70
1011+ ]
1012+
9741013 let info =
9751014 Cmd. info
9761015 ~man
1016+ ~exits
9771017 ~sdocs: Manpage. s_options
9781018 ~doc: " Set configuration."
9791019 " set-options"
@@ -1050,9 +1090,11 @@ module Fetch = struct
10501090 let exits =
10511091 let open Cmd.Exit in
10521092 [ info ~doc: " Default exit." ok
1053- ; info ~doc: " There was a file already present on the local side." 1
1093+ ; info ~doc: " Either sever-side error or there was a file already present on the local side." 1
10541094 ; info ~doc: " A specified exercise was not found on the server." 2
1055- ; info ~doc: " Both of 1 and 2." 3 ]
1095+ ; info ~doc: " Both of 1 (for local side) and 2." 3
1096+ ; info ~doc: " The client's version is incompatible (too old?) w.r.t. the server." 70
1097+ ]
10561098
10571099 let info =
10581100 Cmd. info
@@ -1091,9 +1133,18 @@ module Create_token = struct
10911133 let man = man " Create a token on the server with the desired nickname.\
10921134 Prodiving a token will test if it exists on the server."
10931135
1136+ let exits =
1137+ let open Cmd.Exit in
1138+ [ info ~doc: " Default exit." ok
1139+ ; info ~doc: " Server error: either unable to reach the server or request has been failed." 1
1140+ ; info ~doc: " Input error: nickname wasn't provided." 2
1141+ ; info ~doc: " The client's version is incompatible (too old?) w.r.t. the server." 70
1142+ ]
1143+
10941144 let info =
10951145 Cmd. info
10961146 ~man
1147+ ~exits
10971148 ~sdocs: Manpage. s_options
10981149 ~doc: " Create a token."
10991150 " create-token"
@@ -1125,9 +1176,19 @@ module Template = struct
11251176
11261177 let man = man " Get the template of a given exercise"
11271178
1179+ let exits =
1180+ let open Cmd.Exit in
1181+ [ info ~doc: " Default exit." ok
1182+ ; info ~doc: " Sever error: unable to find config file or request has been failed." 1
1183+ ; info ~doc: " Input error: exercise id wasn't provided." 2
1184+ ; info ~doc: " Exercise with given id already exists." 3
1185+ ; info ~doc: " The client's version is incompatible (too old?) w.r.t. the server." 70
1186+ ]
1187+
11281188 let info =
11291189 Cmd. info
11301190 ~man
1191+ ~exits
11311192 ~sdocs: Manpage. s_options
11321193 ~doc: " Get the template of a given exercise."
11331194 " template"
@@ -1161,7 +1222,14 @@ module Exercise_list = struct
11611222
11621223 let man = man doc
11631224
1164- let info = Cmd. info ~man ~doc: doc ~sdocs: Manpage. s_options " exercise-list"
1225+ let exits =
1226+ let open Cmd.Exit in
1227+ [ info ~doc: " Default exit." ok
1228+ ; info ~doc: " Sever error: unable to find config file or request has been failed." 1
1229+ ; info ~doc: " The client's version is incompatible (too old?) w.r.t. the server." 70
1230+ ]
1231+
1232+ let info = Cmd. info ~man ~exits ~doc: doc ~sdocs: Manpage. s_options " exercise-list"
11651233
11661234 let term = use_global exercise_list
11671235end
@@ -1194,6 +1262,7 @@ module Main = struct
11941262 Cmd. info
11951263 ~version
11961264 ~man
1265+ ~exits: Grade. exits
11971266 ~sdocs: s_options
11981267 ~doc: " Learn-ocaml client CLI."
11991268 " learn-ocaml-client"
0 commit comments