Commit cf5a8917 authored by Yuanle Song's avatar Yuanle Song
Browse files

binary code released on pypi

parent 09717a9f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
.stack-work/
*.cabal
dist/
build/
*.egg-info/
pypi/rd-client/rdclient/rd
pypi/rd-api/rdapi/rd-api
+10 −7
Original line number Diff line number Diff line
@@ -68,6 +68,9 @@ runApiServer rdConfig = do
main :: IO ()
main = do
  rdConfig <- execParser opts
  if showVersion rdConfig then
      putStrLn "rd-api 1.0.0.0"
  else do
    resultMaybe <- runMaybeT $ runApiServer rdConfig
    when (isNothing resultMaybe) $
      die "start rd-api failed"
+4 −0
Original line number Diff line number Diff line
@@ -48,3 +48,7 @@ argParser = RDConfig
      <> showDefault
      <> value 2
      <> metavar "INT")
  <*> switch
      (  long "version"
      <> short 'V'
      <> help "show program version and exit" )
+13 −3
Original line number Diff line number Diff line
@@ -304,8 +304,18 @@ cliApp opts = do
      exitFailure

main :: IO ()
main = cliApp =<< execParser opts where
    opts = info (argParser <**> helper)
main = do
  opts <- execParser parserInfo
  if showVersion opts then
      putStrLn "rd 1.0.0.0"
  else
    if null $ urls opts then do
      putStrLn "No URLs given, nothing to do. See rd --help"
      exitFailure
    else
      cliApp opts
  where
    parserInfo = info (argParser <**> helper)
      (  fullDesc
      <> header "rd - reliable download command line tool"
      <> progDesc "Download large files across GFW reliably. Requires using rd-api on server side. For more information, see rd-api --help")
      <> progDesc "Download large files across slow and unstable network reliably. Requires using rd-api on server side. For more information, see rd-api --help")
+6 −1
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ data RDOptions = RDOptions
  , workerCount :: Int
  , forceOverwrite :: Bool
  , verbose :: Bool
  , showVersion :: Bool
  , urls :: [T.Text] } deriving (Show)

data RDClientRuntimeConfig = RDClientRuntimeConfig
@@ -65,4 +66,8 @@ argParser = RDOptions
      <> short 'v'
      <> help "show more debug message"
      <> showDefault )
  <*> some (argument str (metavar "URL..."))
  <*> switch
      (  long "version"
      <> short 'V'
      <> help "show version number and exit" )
  <*> many (argument str (metavar "URL..."))
Loading