on master help sign in
Move profile flags top level

adds: - profileRtsFlag - profileOutputFlag to avoid massively long lines.

commita505c203b873883e0c16d4da4d1607b203904767 authorMatthew Bauer <mjbauer95@gmail.com> dateThu 20 Feb 2020, 12:12 (7 years ago) parent92c1a4a
1 file changed+16−1
lib/command/src/Obelisk/Command.hs+16−1
lib/command/src/Obelisk/Command.hs+16−1
@@ -109,7 +109,7 @@ obCommand cfg = hsubparser
109109 [ command "init" $ info (ObCommand_Init <$> initSource <*> initForce) $ progDesc "Initialize an Obelisk project"
110110 , command "deploy" $ info (ObCommand_Deploy <$> deployCommand cfg) $ progDesc "Prepare a deployment for an Obelisk project"
111111 , command "run" $ info (pure ObCommand_Run) $ progDesc "Run current project in development mode"
112− , command "profile" $ info (ObCommand_Profile <$> (strOption (long "output" <> short 'o' <> help "Base output to use for profiling output. Suffixes are added to this based on the profiling type. Defaults to a timestamped path in the profile/ directory in the project's root." <> metavar "PATH" <> value "profile/%Y-%m-%dT%H:%M:%S" <> showDefault)) <*> (words <$> strOption (long "rts-flags" <> help "RTS Flags to pass to the executable." <> value "-p -hc" <> metavar "FLAGS" <> showDefault))) $ progDesc "Run current project with profiling enabled"
112+ , command "profile" $ info (ObCommand_Profile <$> profileOutputFlag <*> profileRtsFlag) $ progDesc "Run current project with profiling enabled"
113113 , command "thunk" $ info (ObCommand_Thunk <$> thunkCommand) $ progDesc "Manipulate thunk directories"
114114 , command "repl" $ info (pure ObCommand_Repl) $ progDesc "Open an interactive interpreter"
115115 , command "watch" $ info (pure ObCommand_Watch) $ progDesc "Watch current project for errors and warnings"
@@ -224,6 +224,21 @@ thunkCommand = hsubparser $ mconcat
224224 , command "pack" $ info (ThunkCommand_Pack <$> some thunkDirectoryParser <*> thunkPackConfig) $ progDesc "Pack git checkout into thunk that points at the current branch's upstream"
225225 ]
226226
227+profileRtsFlag :: Parser [String]
228+profileRtsFlag = words <$> strOption ( long "rts-flags"
229+ <> help "RTS Flags to pass to the executable."
230+ <> value "-p -hc"
231+ <> metavar "FLAGS"
232+ <> showDefault)
233+
234+profileOutputFlag :: Parser String
235+profileOutputFlag = strOption ( long "output"
236+ <> short 'o'
237+ <> help "Base output to use for profiling output. Suffixes are added to this based on the profiling type. Defaults to a timestamped path in the profile/ directory in the project's root."
238+ <> metavar "PATH"
239+ <> value "profile/%Y-%m-%dT%H:%M:%S"
240+ <> showDefault)
241+
227242data ShellOpts
228243 = ShellOpts
229244 { _shellOpts_shell :: String