diff --git a/man/stackctl.1.ronn b/man/stackctl.1.ronn index 5f9ec2f..8863fb2 100644 --- a/man/stackctl.1.ronn +++ b/man/stackctl.1.ronn @@ -8,7 +8,8 @@ stackctl(1) - manage CloudFormation Stacks through specifications ## OPTIONS * `-d`, `--directory`=: - Where to find specifications. Default is `.`. + Use the stack collection located at (default: current working + directory). * `--filter`=: Restrict specifications to those whose paths match any given . diff --git a/package.yaml b/package.yaml index 7cd0871..865ec01 100644 --- a/package.yaml +++ b/package.yaml @@ -88,6 +88,7 @@ library: - monad-logger - mtl - optparse-applicative + - prettyprinter - resourcet - rio - semigroups diff --git a/src/Stackctl/DirectoryOption.hs b/src/Stackctl/DirectoryOption.hs index a156a84..9acb7d9 100644 --- a/src/Stackctl/DirectoryOption.hs +++ b/src/Stackctl/DirectoryOption.hs @@ -30,7 +30,7 @@ instance HasDirectoryOption DirectoryOption where envDirectoryOption :: Env.Parser Env.Error DirectoryOption envDirectoryOption = Env.var (Env.str <=< Env.nonempty) "DIRECTORY" - $ Env.help "Operate on specifications in this directory" + $ Env.help directoryHelp directoryOption :: Parser DirectoryOption directoryOption = @@ -39,6 +39,10 @@ directoryOption = [ short 'd' , long "directory" , metavar "PATH" - , help "Operate on specifications in PATH" + , help directoryHelp , action "directory" ] + +directoryHelp :: String +directoryHelp = + "Use the stack collection located at PATH (default: current working directory)" diff --git a/src/Stackctl/Subcommand.hs b/src/Stackctl/Subcommand.hs index eb84864..ec7d33c 100644 --- a/src/Stackctl/Subcommand.hs +++ b/src/Stackctl/Subcommand.hs @@ -10,6 +10,8 @@ import Stackctl.Prelude import qualified Env import Options.Applicative +import Prettyprinter (pretty, vsep) +import Prettyprinter.Util (reflow) import Stackctl.AWS (handlingServiceError) import Stackctl.AutoSSO import Stackctl.CLI @@ -46,7 +48,9 @@ runSubcommand' title parseEnv parseCLI sp = do (options, act) <- applyEnv <$> Env.parse (Env.header $ unpack title) parseEnv - <*> execParser (withInfo title $ (,) <$> parseCLI <*> subparser sp) + <*> customExecParser + (prefs helpShowGlobals) + (withInfo title $ (,) <$> parseCLI <*> subparser sp) act options where @@ -78,4 +82,15 @@ runAppSubcommand f subOptions options = $ f subOptions withInfo :: Text -> Parser a -> ParserInfo a -withInfo d p = info (p <**> helper) $ progDesc (unpack d) <> fullDesc +withInfo d p = + info (p <**> helper) + $ progDescDoc + $ Just + $ vsep + [ pretty d + , "" + , reflow + $ "By default, this will operate on the entire stack collection. To" + <> " operate on a specific stack or set of stacks, use the --filter" + <> " argument to filter the collection by file path." + ] diff --git a/stackctl.cabal b/stackctl.cabal index 7d0a84c..c920407 100644 --- a/stackctl.cabal +++ b/stackctl.cabal @@ -1,6 +1,6 @@ cabal-version: 1.18 --- This file has been generated from package.yaml by hpack version 0.37.0. +-- This file has been generated from package.yaml by hpack version 0.38.1. -- -- see: https://github.com/sol/hpack @@ -128,6 +128,7 @@ library , monad-logger , mtl , optparse-applicative + , prettyprinter , resourcet , rio , semigroups