diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Command.hs | 1 | ||||
-rw-r--r-- | src/Command/Run.hs | 1 | ||||
-rw-r--r-- | src/Main.hs | 15 |
3 files changed, 15 insertions, 2 deletions
diff --git a/src/Command.hs b/src/Command.hs index ae24534..0ca6710 100644 --- a/src/Command.hs +++ b/src/Command.hs @@ -19,6 +19,7 @@ import Config class CommandArgumentsType (CommandArguments c) => Command c where commandName :: proxy c -> String + commandDescription :: proxy c -> String type CommandOptions c :: Type type CommandOptions c = () diff --git a/src/Command/Run.hs b/src/Command/Run.hs index 677f8f1..daba8af 100644 --- a/src/Command/Run.hs +++ b/src/Command/Run.hs @@ -24,6 +24,7 @@ data RunCommand = RunCommand Text instance Command RunCommand where commandName _ = "run" + commandDescription _ = "Execude jobs per minici.yaml for given commits" type CommandArguments RunCommand = Maybe Text diff --git a/src/Main.hs b/src/Main.hs index 7dcc484..cdce0f9 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -61,8 +61,19 @@ main = do exitFailure when (optShowHelp opts) $ do - let header = "Usage: minici [<option>...] <command> [<args>]" - putStr $ usageInfo header options + let header = "Usage: minici [<option>...] <command> [<args>]\n\nCommon options are:" + commandDesc (SC proxy) = " " <> padCommand (commandName proxy) <> commandDescription proxy + + padTo n str = str <> replicate (n - length str) ' ' + padCommand = padTo (maxCommandNameLength + 3) + commandNameLength (SC proxy) = length $ commandName proxy + maxCommandNameLength = maximum $ map commandNameLength commands + + putStr $ usageInfo header options <> unlines ( + [ "" + , "Available commands:" + ] ++ map commandDesc commands + ) exitSuccess when (optShowVersion opts) $ do |