ptionsParser :: Parser Options
optionsParser = Options <$> parsePool
                        <*> parseUser
                        <*> parseNS
                        <*> parseAction
  where
    parsePool = strOption $
           long "pool"
        <> short 'p'
        <> metavar "POOL"
        <> help "Ceph pool name for storage"

    parseUser = optional . strOption $
           long "user"
        <> short 'u'
        <> metavar "USER"
        <> help "Ceph user for access to storage"

    parseNS = option auto $
        long "origin"
        <> short 'o'
        <> help "Origin (namespace)"

    parseAction = subparser parseRegisterAction

    parseRegisterAction =
        componentHelper "register" registerActionParser "Register a namespace (origin)"

    componentHelper cmd_name parser desc =
        command cmd_name (info (helper <*> parser) (progDesc desc))

optionsParser :: Parser Options
optionsParser = Options <$> parsePool
                        <*> parseUser
                        <*> parseNS
                        <*> parseAction
  where
    parsePool = strOption $
           long "pool"
        <> short 'p'
        <> metavar "POOL"
        <> help "Ceph pool name for storage"

    parseUser = optional . strOption $
           long "user"
        <> short 'u'
        <> metavar "USER"
        <> help "Ceph user for access to storage"

    parseNS = option auto $
        long "origin"
        <> short 'o'
        <> help "Origin (namespace)"

    parseAction = subparser parseRegisterAction

    parseRegisterAction =
        componentHelper "register" registerActionParser "Register a namespace (origin)"

    componentHelper cmd_name parser desc =
        command cmd_name (info (helper <*> parser) (progDesc desc))
optionsParser = Options <$> parsePool
                        <*> parseUser
                        <*> parseNS
                        <*> parseAction
  where
    parsePool = strOption $
           long "pool"
        <> short 'p'
        <> metavar "POOL"
        <> help "Ceph pool name for storage"

    parseUser = optional . strOption $
           long "user"
        <> short 'u'
        <> metavar "USER"
        <> help "Ceph user for access to storage"

    parseNS = option auto $
        long "origin"
        <> short 'o'
        <> help "Origin (namespace)"

    parseAction = subparser parseRegisterAction

    parseRegisterAction =
        componentHelper "register" registerActionParser "Register a namespace (origin)"

    componentHelper cmd_name parser desc =
        command cmd_name (info (helper <*> parser) (progDesc desc))