Implement how command line interface using Glcmd
leovalais opened this issue · comments
The key to make html_of_wiki a decent and usable tool is to polish its user interface. Currently users have to deal with shell scipts (poorly tested and documented, with too little error management đ) such as dop
and quickdop
. They were meant to make html_of_wiki quickly usable of Ocsigen but not for other end users.
Thus, implement an OCaml đ« program, how
, which re-implements all the features of both dop
and quickdop
and get rid of these crappy scripts (:+1:). A modern and popular command line interface is the sub-command system that git
uses. Here is a list of the features how
has to implement (in combination with #106, this is an extract of a draft design file---please pay no attention to the format):
- ~how~ :: alias pour ~how help~
- ~how help~ :: affiche la liste des commandes de premier niveau
- ~how help CMD~ :: affiche l'aide de la ~CMD~ donnée
- ~how init~ :: crée dans le dossier courant un fichier ~how.yml~ contenant une configuration par défaut
- ~how init infer~ :: la configuration est déduite à partir de l'examen du dossier
- ~how init default~ :: comme ~how init~
- ~how config~ :: == ~how config help~
- ~how config help~ :: affiche l'aide de chaque option de configuration
- ~how config check~ :: vérifie la validité de la configuration (pas de dossier n'existant pas)
- ~how config infer~ :: affiche une configuration minimale déduite
- ~how build [-d DIR] [VERSIONS...]~ :: compile les versions données (ou toutes si aucune n'est donnée) dans ~DIR |? _build~
- ~how deploy [-d DIR] [-m MSG] [-r REPO]~ :: dĂ©ploie le site sur GHPages (override l'option ~deploy~) et commit avec le ~MSG~ donnĂ© dans le ~REPO~ donnĂ© (~upstream~ par dĂ©faut). Ăchoue si le cwd n'est pas un dĂ©pĂŽt git.
- ~how check~ :: fais tous les checks
- ~how check links [-d DIR] [-r|--raw] [-s|--silent]~ :: vérifie les liens morts du ~DIR~ et sort sur stderr le json. Si ~raw~ est donné sort directement l'output de linkchecker.
- ~how check config~ :: == ~how config check~
To implement all that complex argv
parsing, the module Glcmd
(Git-Like CoMmanDs) has been designed (see #88). It helps to express declaratively what options each sub-command takes and does the parsing all by itself. Here is what has already been implemented:
Lines 119 to 155 in e4314fd
Glcmd sound very similar to Core.Command
I didn't know about Core.Command
. This PR is an experiment to give how
the same command line interface as Git, with verbs and parameters. Glcmd
(the library ohow
uses) doesn't support such verbs.
This issue isn't really important unless html_of_wiki is to be used by many unexperienced people, which isn't currently the case.