diff options
author | 2015-07-08 15:39:05 -0400 | |
---|---|---|
committer | 2015-07-08 15:39:05 -0400 | |
commit | b2252febf1355e62a00fb735831d3b2a1aed2566 (patch) | |
tree | 621fb71f80252d300436261bb1d67ee537d1f7e9 /Command | |
parent | e7e61fb6cbe5455ded9bb550a64121223c099fc2 (diff) |
support cmdnorepo actions, also using getopt-applicative there
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Assistant.hs | 9 | ||||
-rw-r--r-- | Command/Help.hs | 9 | ||||
-rw-r--r-- | Command/Test.hs | 6 | ||||
-rw-r--r-- | Command/Version.hs | 10 | ||||
-rw-r--r-- | Command/WebApp.hs | 7 | ||||
-rw-r--r-- | Command/XMPPGit.hs | 9 |
6 files changed, 31 insertions, 19 deletions
diff --git a/Command/Assistant.hs b/Command/Assistant.hs index 51d5a46b2..08e96da07 100644 --- a/Command/Assistant.hs +++ b/Command/Assistant.hs @@ -20,10 +20,11 @@ import Assistant.Install import System.Environment cmd :: Command -cmd = noRepo checkNoRepoOpts $ dontCheck repoExists $ withOptions options $ - notBareRepo $ command "assistant" SectionCommon - "automatically sync changes" - paramNothing (withParams seek) +cmd = dontCheck repoExists $ withOptions options $ notBareRepo $ + noRepo (withParams checkNoRepoOpts) $ + command "assistant" SectionCommon + "automatically sync changes" + paramNothing (withParams seek) options :: [Option] options = diff --git a/Command/Help.hs b/Command/Help.hs index 08873e2bb..17ed8cd0b 100644 --- a/Command/Help.hs +++ b/Command/Help.hs @@ -22,9 +22,12 @@ import qualified Command.Fsck import System.Console.GetOpt cmd :: Command -cmd = noCommit $ noRepo startNoRepo $ dontCheck repoExists $ - command "help" SectionCommon "display help" - "COMMAND" (withParams seek) +cmd = noCommit $ dontCheck repoExists $ + noRepo (parseparams startNoRepo) $ + command "help" SectionCommon "display help" + "COMMAND" (parseparams seek) + where + parseparams = withParams seek :: CmdParams -> CommandSeek seek = withWords start diff --git a/Command/Test.hs b/Command/Test.hs index 6f9c23d2d..57a9b16d3 100644 --- a/Command/Test.hs +++ b/Command/Test.hs @@ -12,10 +12,12 @@ import Command import Messages cmd :: Command -cmd = noRepo startIO $ dontCheck repoExists $ +cmd = noRepo (parseparams startIO) $ dontCheck repoExists $ command "test" SectionTesting "run built-in test suite" - paramNothing (withParams seek) + paramNothing (parseparams seek) + where + parseparams = withParams seek :: CmdParams -> CommandSeek seek = withWords start diff --git a/Command/Version.hs b/Command/Version.hs index 70aea8f2c..38c799675 100644 --- a/Command/Version.hs +++ b/Command/Version.hs @@ -18,10 +18,12 @@ import qualified Remote import qualified Backend cmd :: Command -cmd = withOptions [rawOption] $ - noCommit $ noRepo startNoRepo $ dontCheck repoExists $ - command "version" SectionQuery "show version info" - paramNothing (withParams seek) +cmd = withOptions [rawOption] $ dontCheck repoExists $ noCommit $ + noRepo (parseparams startNoRepo) $ + command "version" SectionQuery "show version info" + paramNothing (parseparams seek) + where + parseparams = withParams rawOption :: Option rawOption = flagOption [] "raw" "output only program version" diff --git a/Command/WebApp.hs b/Command/WebApp.hs index 2a639e489..2e41ebe7d 100644 --- a/Command/WebApp.hs +++ b/Command/WebApp.hs @@ -39,9 +39,10 @@ import System.Environment (getArgs) cmd :: Command cmd = withOptions [listenOption] $ - noCommit $ noRepo startNoRepo $ dontCheck repoExists $ notBareRepo $ - command "webapp" SectionCommon "launch webapp" - paramNothing (withParams seek) + noCommit $ dontCheck repoExists $ notBareRepo $ + noRepo (withParams startNoRepo) $ + command "webapp" SectionCommon "launch webapp" + paramNothing (withParams seek) listenOption :: Option listenOption = fieldOption [] "listen" paramAddress diff --git a/Command/XMPPGit.hs b/Command/XMPPGit.hs index 7d7d99476..86d8dbc11 100644 --- a/Command/XMPPGit.hs +++ b/Command/XMPPGit.hs @@ -12,9 +12,12 @@ import Command import Assistant.XMPP.Git cmd :: Command -cmd = noCommit $ noRepo startNoRepo $ dontCheck repoExists $ - command "xmppgit" SectionPlumbing "git to XMPP relay" - paramNothing (withParams seek) +cmd = noCommit $ dontCheck repoExists $ + noRepo (parseparams startNoRepo) $ + command "xmppgit" SectionPlumbing "git to XMPP relay" + paramNothing (parseparams seek) + where + parseparams = withParams seek :: CmdParams -> CommandSeek seek = withWords start |