diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-05-31 16:20:55 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-05-31 16:49:28 -0400 |
commit | 75ae06595a6971eb21630928bcdd3f33c06b3ea0 (patch) | |
tree | 9bb64df745731601e451e092235715f22c2e9ad7 /CmdLine | |
parent | c2f804b9b2d80af91bac1d0b074c664efcf8da97 (diff) |
support parsing options like --to=here
Reworked remote name parsing to allow things like that. Command.Move
uses it for --to=here, although there's not yet an implementation of
that option.
This commit was sponsored by Ignacio on Patreon.
Diffstat (limited to 'CmdLine')
-rw-r--r-- | CmdLine/GitAnnex/Options.hs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/CmdLine/GitAnnex/Options.hs b/CmdLine/GitAnnex/Options.hs index 726a6963c..aad0536d8 100644 --- a/CmdLine/GitAnnex/Options.hs +++ b/CmdLine/GitAnnex/Options.hs @@ -1,6 +1,6 @@ {- git-annex command-line option parsing - - - Copyright 2010-2015 Joey Hess <id@joeyh.name> + - Copyright 2010-2017 Joey Hess <id@joeyh.name> - - Licensed under the GNU GPL version 3 or higher. -} @@ -105,10 +105,10 @@ parseAutoOption = switch <> help "automatic mode" ) -parseRemoteOption :: Parser RemoteName -> Parser (DeferredParse Remote) -parseRemoteOption p = DeferredParse +parseRemoteOption :: RemoteName -> DeferredParse Remote +parseRemoteOption = DeferredParse . (fromJust <$$> Remote.byNameWithUUID) - . Just <$> p + . Just data FromToOptions = FromRemote (DeferredParse Remote) @@ -120,18 +120,18 @@ instance DeferredParseClass FromToOptions where parseFromToOptions :: Parser FromToOptions parseFromToOptions = - (FromRemote <$> parseFromOption) - <|> (ToRemote <$> parseToOption) + (FromRemote . parseRemoteOption <$> parseFromOption) + <|> (ToRemote . parseRemoteOption <$> parseToOption) -parseFromOption :: Parser (DeferredParse Remote) -parseFromOption = parseRemoteOption $ strOption +parseFromOption :: Parser RemoteName +parseFromOption = strOption ( long "from" <> short 'f' <> metavar paramRemote <> help "source remote" <> completeRemotes ) -parseToOption :: Parser (DeferredParse Remote) -parseToOption = parseRemoteOption $ strOption +parseToOption :: Parser RemoteName +parseToOption = strOption ( long "to" <> short 't' <> metavar paramRemote <> help "destination remote" <> completeRemotes |