File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -555,14 +555,17 @@ showHelpOnEmpty :: PrefsMod
555555showHelpOnEmpty = PrefsMod $ \ p -> p { prefShowHelpOnEmpty = True }
556556
557557-- | Turn off backtracking after subcommand is parsed.
558+ --
559+ -- /NOTE:/ When this option is used, all remaining arguments /must/ be
560+ -- consumed by the subcommand once it entered.
558561noBacktrack :: PrefsMod
559562noBacktrack = PrefsMod $ \ p -> p { prefBacktrack = NoBacktrack }
560563
561- -- | Allow full mixing of subcommand and parent arguments by inlining
564+ -- | Allow full mixing of subcommand and parent arguments by embedding
562565-- selected subparsers into the parent parser.
563566--
564567-- /NOTE:/ When this option is used, preferences for the subparser which
565- -- effect the parser behaviour (such as noIntersperse) are ignored.
568+ -- effect the parser behaviour (such as @ noIntersperse@ ) are ignored.
566569subparserInline :: PrefsMod
567570subparserInline = PrefsMod $ \ p -> p { prefBacktrack = SubparserInline }
568571
Original file line number Diff line number Diff line change @@ -102,9 +102,27 @@ data ParserInfo a = ParserInfo
102102instance Functor ParserInfo where
103103 fmap f i = i { infoParser = fmap f (infoParser i) }
104104
105+ -- | Behaviour for how subcommands are executed within a parser.
105106data Backtracking
107+ -- | When a subcommand is complete, parsing will drop back to the parent
108+ -- command (this is the default behaviour).
109+ --
110+ -- /NOTE:/ Options which aren't recognised by the subcommand may be tried
111+ -- by the parent (if the subcommand is satisfied) and errors raised against
112+ -- the parent parser.
106113 = Backtrack
114+ -- | Subcommands do not drop back to the parent when complete, and must
115+ -- consume all remaining arguments provided.
116+ --
117+ -- This means that multiple sub-commands can not be required at the same
118+ -- level, and all global options /must/ be specified before entering the
119+ -- subcommand.
107120 | NoBacktrack
121+ -- | Subcommands are embeddeed into the parent parser, allowing full mixing
122+ -- of their arguments and that of their parent.
123+ --
124+ -- /NOTE:/ When this option is used, preferences for the subparser which
125+ -- effect the parser behaviour (such as 'noIntersperse') are ignored.
108126 | SubparserInline
109127 deriving (Eq , Show )
110128
You can’t perform that action at this time.
0 commit comments