Browse Source

Improve help subcommand

 + We add the welcome message, previously shown only on first run.
Leo 9 years ago
parent
commit
1ddf959c65
3 changed files with 20 additions and 11 deletions
  1. 1 0
      CHANGELOG.md
  2. 9 4
      src/command_def.ml
  3. 10 7
      src/file_com.ml

+ 1 - 0
CHANGELOG.md

@@ -56,6 +56,7 @@ This version introduce major changes in the tmp and rc file.
    `OC_NOCOLOR`. This is added to the previous variable `OC_TMP`. See #20.
  + Add unit tests and clean them up.
  + Add licence warning.
+ + Improve help messages.
  + Remove core\_extended dependency, incorporating some code from the library
    directly in the program, and using Textutils and Re2 library instead.
  + Display debugging information before each message. Flush stdout on each

+ 9 - 4
src/command_def.ml

@@ -311,15 +311,20 @@ let run ~version ~build_info () =
   (* Parsing with subcommands *)
   let parse_sub () =
     group
-      ~summary:"OcLaunch program is published under CeCILL licence.\n \
+      ~summary:"OcLaunch program is published under CeCILL licence.\n\
                 You may run the program with 'licence' command or see \
                 http://cecill.info/licences/Licence_CeCILL_V2.1-en.html \
                 (http://lnch.ml/cecill) for details. More here: \
                 http://oclaunch.eu.org/floss-under-cecill (http://lnch.ml/l)."
       ~readme:(fun () ->
-             "Use 'help' subcommand to get help (it works both \
-              after the name of the software and with another subcommand). For \
-              further help, see http://oclaunch.eu.org.")
+             String.concat [
+               "Use 'help' subcommand to get help (it works both \
+                after the name of the software and with another subcommand). For \
+                further help, see http://oclaunch.eu.org." ;
+               "\n" ;
+               File_com.welcome_msg
+             ]
+           )
       ~preserve_subcommand_order:()
       [ ("run", default) ; ("licence", licence) ; ("add", add) ; ("edit", edit)
       ; ("list", list) ; ("cleanup", clean) ; ("delete", delete)

+ 10 - 7
src/file_com.ml

@@ -41,6 +41,15 @@ open Core.Std;;
 (* Type of the values *)
 type t = Settings_v.rc_file;;
 
+(* Message to display on first use, i.e. on initialisation of rc file *)
+let welcome_msg =
+  "Feedback is welcome at feedback@oclaunch.eu.org.\n\
+   To get remind for new stable versions, subscribe to our low-traffic (up \
+   to 6 mail per year) mailing list: announce@oclaunch.eu.org. \
+   More here: https://lnch.ml/ml\n\
+   See you soon! To keep in touch: https://lnch.ml/kit\n";
+;;
+
 (* Function to write the rc file *)
 let write (rc_file:t) =
   (* Short name *)
@@ -63,13 +72,7 @@ let create_rc_file ~name =
   (* Notify that we initialise config file *)
   sprintf "Initializing empty configuration file in %s." name |> Messages.warning;
   (* Final \n to display newline before showing the licence. *)
-  Messages.tips
-    "Feedback is welcome at feedback@oclaunch.eu.org.\n\
-     To get remind for new stable versions, subscribe to our low-traffic (up \
-     to 6 mail per year) mailing list: announce@oclaunch.eu.org. \
-     More here: https://lnch.ml/ml\n\
-     See you soon! To keep in touch: https://lnch.ml/kit\n";
-
+  Messages.tips welcome_msg;
   (* Display licence information *)
   Licencing.print ~cecill:false;