diff options
author | Andrew Cady <d@jerkface.net> | 2017-03-02 01:41:34 -0500 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2017-03-02 01:41:34 -0500 |
commit | 3b63031cf24c24559b22ebfef3962a382566d481 (patch) | |
tree | 824e6ac7f7b7acd9b17c0cb2ec2e703e7a867327 | |
parent | d489dcbc4ed286c54e4d1fc6502cf7e074a60dc2 (diff) |
improve command-line usage help
-rw-r--r-- | acme-certify.hs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/acme-certify.hs b/acme-certify.hs index 71309fb..6cb3c05 100644 --- a/acme-certify.hs +++ b/acme-certify.hs | |||
@@ -64,19 +64,29 @@ Just stagingDirectoryUrl = parseAbsoluteURI "https://acme-staging.api.letsencryp | |||
64 | Just defaultTerms = parseAbsoluteURI "https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf" | 64 | Just defaultTerms = parseAbsoluteURI "https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf" |
65 | 65 | ||
66 | main :: IO () | 66 | main :: IO () |
67 | main = execParser (info opts idm) >>= run | 67 | main = customExecParser (prefs showHelpOnError) (info opts desc) >>= run |
68 | where | 68 | where |
69 | opts :: Parser Options | 69 | opts :: Parser Options |
70 | opts = Options <$> parseCommand | 70 | opts = Options <$> parseCommand |
71 | parseCommand :: Parser Command | 71 | parseCommand :: Parser Command |
72 | parseCommand = subparser $ | 72 | parseCommand = subparser $ |
73 | command "certify" (info (helper <*> certifyOpts) desc) <> | 73 | command "certify" (info (helper <*> certifyOpts) certifyDesc) <> |
74 | command "update" (info (helper <*> updateOpts) desc) | 74 | command "update" (info (helper <*> updateOpts) updateDesc) |
75 | |||
75 | desc = fullDesc <> progDesc detailedDescription <> Opt.header "Let's Encrypt! ACME client" | 76 | desc = fullDesc <> progDesc detailedDescription <> Opt.header "Let's Encrypt! ACME client" |
76 | detailedDescription = unwords | 77 | detailedDescription = unwords |
77 | [ "This program will generate a signed TLS certificate" | 78 | [ "This program generates signed TLS certificates" |
78 | , "using the ACME protocol and the free Let's Encrypt! CA." | 79 | , "using the ACME protocol and the free Let's Encrypt! CA." |
79 | ] | 80 | ] |
81 | |||
82 | certifyDesc = progDesc $ unwords | ||
83 | [ "Generate a single signed TLS certificate" | ||
84 | , "for one or more domains." | ||
85 | ] | ||
86 | updateDesc = progDesc $ unwords | ||
87 | [ "Generate any number of signed TLS certificates," | ||
88 | , "each certifying any number of domains." | ||
89 | ] | ||
80 | run :: Options -> IO () | 90 | run :: Options -> IO () |
81 | run (Options (Certify opts)) = runCertify opts >>= either (error . ("Error: " ++)) return | 91 | run (Options (Certify opts)) = runCertify opts >>= either (error . ("Error: " ++)) return |
82 | run (Options (Update opts)) = runUpdate opts | 92 | run (Options (Update opts)) = runUpdate opts |