diff options
Diffstat (limited to 'locopy/Locopy/CommandLine.hs')
| -rw-r--r-- | locopy/Locopy/CommandLine.hs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/locopy/Locopy/CommandLine.hs b/locopy/Locopy/CommandLine.hs new file mode 100644 index 0000000..0146cc9 --- /dev/null +++ b/locopy/Locopy/CommandLine.hs @@ -0,0 +1,44 @@ +{- This Source Code Form is subject to the terms of the Mozilla Public License, + v. 2.0. If a copy of the MPL was not distributed with this file, You can + obtain one at https://mozilla.org/MPL/2.0/. -} + +module Locopy.CommandLine + ( CommandLine(..) + , Wordpress(..) + , commandLine + ) where + +import Options.Applicative + ( Parser + , ParserInfo(..) + , command + , header + , help + , hsubparser + , idm + , info + , long + , metavar + , strOption + ) + +data Wordpress = Wordpress + { root :: FilePath + , siteurl :: String + } + +newtype CommandLine + = WordpressCommand Wordpress + +wordpress :: Parser CommandLine +wordpress = fmap WordpressCommand + $ Wordpress + <$> strOption (long "root" <> metavar "ROOT" <> help "Website configuration directory") + <*> strOption (long "siteurl" <> metavar "HOME" <> help "siteurl and home address") + +commandLine :: ParserInfo CommandLine +commandLine = info subcommand (header "locopy (wordpress) [OPTIONS]") + where + subcommand = hsubparser + ( command "wordpress" (info wordpress idm) + ) |
