[darcs-devel] darcs --list-options as an alternative to darcs --commands

Ben Franksen ben.franksen at online.de
Thu Mar 16 00:00:58 UTC 2017


Hi Gian

Am 09.03.2017 um 18:03 schrieb Gian Piero Carrubba:
> in src/Darcs/UI/Options/All.hs there's:
>
> rootActions :: PrimDarcsOption (Maybe RootAction)
> rootActions = withDefault Nothing
>  [ RawNoArg ['h'] ["help", "overview"] F.Help (Just RootHelp)
>    "show a brief description of all darcs commands and top-level options"
>  , RawNoArg ['v'] ["version"] F.Version  (Just Version) "show the darcs
> version"
>  , RawNoArg [] ["exact-version"] F.ExactVersion (Just ExactVersion)
>    "show the exact darcs version"
>    -- the switch --commands is here for compatibility only
>  , RawNoArg [] ["commands","list-options"] F.ListCommands (Just
> ListCommands)
>    "show plain list of available options and commands, for auto-completion"
>  ]
>
> Am I right thinking that the intention was to let --command and
> --list-options be interchangeable when given as root action? This is not
> working (No such command '--list-options') but I haven't understood why.

Darcs.UI.Options.All is the result of reverse-engineering which command 
used which options. But not everything you find in there is actually 
used in the rest of Darcs.UI, rootActions is an example for that. The 
point here is that, in the current implementation, plain 'darcs' is not 
a command; there exists no 'root command' (although things would become 
simpler and more elegant if there were). I added the rootActions to have 
at least a nominal spec of what is allowed at the top of the command 
tree. The --commands switch is actually implemented in darcs/darcs.hs.

Cheers
Ben



More information about the darcs-devel mailing list