2019-08-13 07:57:30 +03:00
|
|
|
{-# OPTIONS_GHC -Werror -Wall #-}
|
|
|
|
{-# LANGUAGE CPP #-}
|
|
|
|
|
2020-01-23 07:16:09 +03:00
|
|
|
{-|
|
|
|
|
Command line parsing.
|
|
|
|
-}
|
2020-01-24 08:28:38 +03:00
|
|
|
module Urbit.King.CLI where
|
2019-08-13 07:57:30 +03:00
|
|
|
|
|
|
|
import ClassyPrelude
|
|
|
|
import Options.Applicative
|
|
|
|
import Options.Applicative.Help.Pretty
|
|
|
|
|
|
|
|
import Data.Word (Word16)
|
|
|
|
import System.Environment (getProgName)
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
2020-05-03 19:29:00 +03:00
|
|
|
data KingOpts = KingOpts
|
|
|
|
{ koSharedHttpPort :: Maybe Word16
|
|
|
|
, koSharedHttpsPort :: Maybe Word16
|
|
|
|
}
|
|
|
|
deriving (Show)
|
|
|
|
|
2019-08-13 07:57:30 +03:00
|
|
|
data Opts = Opts
|
2020-03-03 02:24:28 +03:00
|
|
|
{ oQuiet :: Bool
|
|
|
|
, oHashless :: Bool
|
|
|
|
, oExit :: Bool
|
|
|
|
, oDryRun :: Bool
|
|
|
|
, oDryFrom :: Maybe Word64
|
|
|
|
, oVerbose :: Bool
|
|
|
|
, oAmesPort :: Maybe Word16
|
2020-05-13 02:55:49 +03:00
|
|
|
, oNoAmes :: Bool
|
|
|
|
, oNoHttp :: Bool
|
|
|
|
, oNoHttps :: Bool
|
2020-03-03 02:24:28 +03:00
|
|
|
, oTrace :: Bool
|
|
|
|
, oCollectFx :: Bool
|
|
|
|
, oLocalhost :: Bool
|
|
|
|
, oOffline :: Bool
|
|
|
|
, oFullReplay :: Bool
|
|
|
|
, oHttpPort :: Maybe Word16
|
|
|
|
, oHttpsPort :: Maybe Word16
|
|
|
|
, oLoopbackPort :: Maybe Word16
|
2020-06-11 02:41:09 +03:00
|
|
|
, oSerfExe :: Maybe Text
|
2019-08-13 07:57:30 +03:00
|
|
|
}
|
|
|
|
deriving (Show)
|
|
|
|
|
2019-10-01 21:23:34 +03:00
|
|
|
data BootType
|
|
|
|
= BootComet
|
|
|
|
| BootFake Text
|
|
|
|
| BootFromKeyfile FilePath
|
|
|
|
deriving (Show)
|
|
|
|
|
2019-10-16 23:43:47 +03:00
|
|
|
data PillSource
|
|
|
|
= PillSourceFile FilePath
|
|
|
|
| PillSourceURL String
|
|
|
|
deriving (Show)
|
|
|
|
|
2019-08-13 07:57:30 +03:00
|
|
|
data New = New
|
2019-10-16 23:43:47 +03:00
|
|
|
{ nPillSource :: PillSource
|
|
|
|
, nPierPath :: Maybe FilePath -- Derived from ship name if not specified.
|
|
|
|
, nArvoDir :: Maybe FilePath
|
|
|
|
, nBootType :: BootType
|
|
|
|
, nLite :: Bool
|
2019-08-13 07:57:30 +03:00
|
|
|
}
|
|
|
|
deriving (Show)
|
|
|
|
|
|
|
|
data Run = Run
|
2019-08-13 08:56:31 +03:00
|
|
|
{ rPierPath :: FilePath
|
2019-08-13 07:57:30 +03:00
|
|
|
}
|
|
|
|
deriving (Show)
|
|
|
|
|
2019-08-21 03:42:53 +03:00
|
|
|
data Bug
|
2019-08-22 02:49:08 +03:00
|
|
|
= ValidatePill
|
|
|
|
{ bPillPath :: FilePath
|
|
|
|
, bPrintPil :: Bool
|
|
|
|
, bPrintSeq :: Bool
|
|
|
|
}
|
|
|
|
| CollectAllFX
|
|
|
|
{ bPierPath :: FilePath
|
|
|
|
}
|
2019-08-30 02:48:46 +03:00
|
|
|
| EventBrowser
|
|
|
|
{ bPierPath :: FilePath
|
|
|
|
}
|
2019-08-22 03:29:39 +03:00
|
|
|
| ValidateEvents
|
|
|
|
{ bPierPath :: FilePath
|
|
|
|
, bFirstEvt :: Word64
|
2019-08-22 03:54:00 +03:00
|
|
|
, bFinalEvt :: Word64
|
2019-08-22 03:29:39 +03:00
|
|
|
}
|
|
|
|
| ValidateFX
|
|
|
|
{ bPierPath :: FilePath
|
2019-08-22 03:54:00 +03:00
|
|
|
, bFirstEvt :: Word64
|
|
|
|
, bFinalEvt :: Word64
|
2019-08-22 03:29:39 +03:00
|
|
|
}
|
2020-01-11 01:07:29 +03:00
|
|
|
| ReplayEvents
|
|
|
|
{ bPierPath :: FilePath
|
|
|
|
, bFinalEvt :: Word64
|
|
|
|
}
|
2019-09-20 01:40:23 +03:00
|
|
|
| CheckDawn
|
2019-09-24 02:42:12 +03:00
|
|
|
{ bKeyfilePath :: FilePath
|
|
|
|
}
|
2019-10-02 23:55:30 +03:00
|
|
|
| CheckComet
|
2019-08-21 03:42:53 +03:00
|
|
|
deriving (Show)
|
|
|
|
|
2019-08-13 07:57:30 +03:00
|
|
|
data Cmd
|
|
|
|
= CmdNew New Opts
|
2020-05-03 19:29:00 +03:00
|
|
|
| CmdRun KingOpts [(Run, Opts, Bool)]
|
2019-08-21 03:42:53 +03:00
|
|
|
| CmdBug Bug
|
2019-12-17 19:55:10 +03:00
|
|
|
| CmdCon FilePath
|
2019-08-13 07:57:30 +03:00
|
|
|
deriving (Show)
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
headNote :: String -> Doc
|
|
|
|
headNote _version = string $ intercalate "\n"
|
|
|
|
[ "Urbit: a personal server operating function"
|
|
|
|
, "https://urbit.org"
|
2020-01-24 08:20:43 +03:00
|
|
|
, "Version " <> VERSION_urbit_king
|
2019-08-13 07:57:30 +03:00
|
|
|
]
|
|
|
|
|
2020-01-23 07:16:09 +03:00
|
|
|
-- | TODO This needs to be updated.
|
2019-08-13 07:57:30 +03:00
|
|
|
footNote :: String -> Doc
|
|
|
|
footNote exe = string $ intercalate "\n"
|
|
|
|
[ "Development Usage:"
|
|
|
|
, " To create a development ship, use a fakezod:"
|
|
|
|
, " $ " <>exe<> " new zod /path/to/pill -F zod -A arvo/folder"
|
|
|
|
, ""
|
|
|
|
, "Simple Usage: "
|
|
|
|
, " $ " <>exe<> " new pier <my-comet> to create a comet (anonymous urbit)"
|
|
|
|
, " $ " <>exe<> " new pier <my-planet> -k <my-key-file> if you own a planet"
|
|
|
|
, " $ " <>exe<> " run <myplanet or mycomet> to restart an existing urbit"
|
|
|
|
, ""
|
|
|
|
, "For more information about developing on urbit, see:"
|
|
|
|
, " https://github.com/urbit/urbit/blob/master/CONTRIBUTING.md"
|
|
|
|
]
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
parseArgs :: IO Cmd
|
|
|
|
parseArgs = do
|
|
|
|
nm <- getProgName
|
|
|
|
|
|
|
|
let p = prefs $ showHelpOnError
|
|
|
|
<> showHelpOnEmpty
|
|
|
|
<> columns 80
|
|
|
|
|
|
|
|
let o = info (cmd <**> helper)
|
|
|
|
$ progDesc "Start an existing Urbit or boot a new one."
|
|
|
|
<> headerDoc (Just $ headNote "0.9001.0")
|
|
|
|
<> footerDoc (Just $ footNote nm)
|
|
|
|
<> fullDesc
|
|
|
|
|
|
|
|
customExecParser p o
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
2019-10-17 02:03:02 +03:00
|
|
|
defaultPillURL :: String
|
2020-01-23 07:16:09 +03:00
|
|
|
defaultPillURL = "https://bootstrap.urbit.org/urbit-v" <> ver <> ".pill"
|
|
|
|
where
|
2020-01-24 08:20:43 +03:00
|
|
|
ver = VERSION_urbit_king
|
2019-10-17 02:03:02 +03:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
2019-10-01 21:23:34 +03:00
|
|
|
newComet :: Parser BootType
|
|
|
|
newComet = flag' BootComet
|
2020-01-23 07:16:09 +03:00
|
|
|
( long "comet"
|
|
|
|
<> help "Boot a new comet"
|
|
|
|
)
|
2019-10-01 21:23:34 +03:00
|
|
|
|
|
|
|
newFakeship :: Parser BootType
|
|
|
|
newFakeship = BootFake <$> strOption
|
|
|
|
(short 'F'
|
|
|
|
<> long "fake"
|
|
|
|
<> metavar "SHIP"
|
|
|
|
<> help "Boot a fakeship")
|
|
|
|
|
|
|
|
newFromKeyfile :: Parser BootType
|
|
|
|
newFromKeyfile = BootFromKeyfile <$> strOption
|
|
|
|
(short 'k'
|
|
|
|
<> long "keyfile"
|
|
|
|
<> metavar "KEYFILE"
|
|
|
|
<> help "Boot from a keyfile")
|
|
|
|
|
2019-10-16 23:43:47 +03:00
|
|
|
pillFromPath :: Parser PillSource
|
|
|
|
pillFromPath = PillSourceFile <$> strOption
|
|
|
|
( short 'B'
|
|
|
|
<> long "pill"
|
|
|
|
<> metavar "PILL"
|
|
|
|
<> help "Path to pill file")
|
|
|
|
|
|
|
|
pillFromURL :: Parser PillSource
|
|
|
|
pillFromURL = PillSourceURL <$> strOption
|
|
|
|
( short 'u'
|
|
|
|
<> long "pill-url"
|
|
|
|
<> metavar "URL"
|
2019-10-17 02:03:02 +03:00
|
|
|
<> value defaultPillURL
|
2019-10-16 23:43:47 +03:00
|
|
|
<> help "URL to pill file")
|
|
|
|
|
2019-12-17 19:55:10 +03:00
|
|
|
pierPath :: Parser FilePath
|
|
|
|
pierPath = strArgument (metavar "PIER" <> help "Path to pier")
|
|
|
|
|
2019-08-13 07:57:30 +03:00
|
|
|
new :: Parser New
|
|
|
|
new = do
|
2019-12-17 19:55:10 +03:00
|
|
|
nPierPath <- optional pierPath
|
2019-08-15 05:42:48 +03:00
|
|
|
|
2019-10-01 21:23:34 +03:00
|
|
|
nBootType <- newComet <|> newFakeship <|> newFromKeyfile
|
|
|
|
|
2019-10-17 02:03:02 +03:00
|
|
|
nPillSource <- pillFromPath <|> pillFromURL
|
2019-08-15 05:42:48 +03:00
|
|
|
|
2019-10-03 21:31:15 +03:00
|
|
|
nLite <- switch
|
|
|
|
$ short 'l'
|
|
|
|
<> long "lite"
|
|
|
|
<> help "Boots ship in lite mode"
|
2019-08-15 05:42:48 +03:00
|
|
|
|
|
|
|
nArvoDir <- option auto
|
|
|
|
$ metavar "PATH"
|
|
|
|
<> short 'A'
|
|
|
|
<> long "arvo"
|
|
|
|
<> value Nothing
|
|
|
|
<> help "Replace initial clay filesys with contents of PATH"
|
2019-08-13 07:57:30 +03:00
|
|
|
|
|
|
|
pure New{..}
|
|
|
|
|
|
|
|
opts :: Parser Opts
|
|
|
|
opts = do
|
2020-03-03 02:53:02 +03:00
|
|
|
oAmesPort <-
|
|
|
|
optional
|
|
|
|
$ option auto
|
|
|
|
$ metavar "PORT"
|
|
|
|
<> short 'p'
|
|
|
|
<> long "ames"
|
|
|
|
<> help "Ames port"
|
|
|
|
<> hidden
|
2020-03-03 02:24:28 +03:00
|
|
|
|
2020-05-13 02:55:49 +03:00
|
|
|
oNoAmes <-
|
|
|
|
switch
|
|
|
|
$ long "no-ames"
|
|
|
|
<> help "Run with Ames disabled."
|
|
|
|
<> hidden
|
|
|
|
|
|
|
|
oNoHttp <-
|
|
|
|
switch
|
|
|
|
$ long "no-http"
|
|
|
|
<> help "Run with HTTP disabled."
|
|
|
|
<> hidden
|
|
|
|
|
|
|
|
oNoHttps <-
|
|
|
|
switch
|
|
|
|
$ long "no-https"
|
|
|
|
<> help "Run with HTTPS disabled."
|
|
|
|
<> hidden
|
|
|
|
|
2020-03-03 02:24:28 +03:00
|
|
|
oHttpPort <-
|
|
|
|
optional
|
|
|
|
$ option auto
|
|
|
|
$ metavar "PORT"
|
|
|
|
<> long "http-port"
|
2020-03-03 02:53:02 +03:00
|
|
|
<> help "HTTP port"
|
|
|
|
<> hidden
|
2020-03-03 02:24:28 +03:00
|
|
|
|
|
|
|
oHttpsPort <-
|
|
|
|
optional
|
|
|
|
$ option auto
|
|
|
|
$ metavar "PORT"
|
|
|
|
<> long "https-port"
|
2020-03-03 02:53:02 +03:00
|
|
|
<> help "HTTPS port"
|
|
|
|
<> hidden
|
2020-03-03 02:24:28 +03:00
|
|
|
|
|
|
|
oLoopbackPort <-
|
|
|
|
optional
|
|
|
|
$ option auto
|
|
|
|
$ metavar "PORT"
|
|
|
|
<> long "loopback-port"
|
2020-03-03 02:53:02 +03:00
|
|
|
<> help "Localhost-only HTTP port"
|
|
|
|
<> hidden
|
2019-08-15 05:42:48 +03:00
|
|
|
|
2020-06-11 02:41:09 +03:00
|
|
|
oSerfExe <-
|
|
|
|
optional
|
2020-06-25 21:37:09 +03:00
|
|
|
$ strOption
|
2020-06-11 02:41:09 +03:00
|
|
|
$ metavar "PATH"
|
|
|
|
<> long "serf"
|
|
|
|
<> help "Path to Serf"
|
|
|
|
<> hidden
|
|
|
|
|
|
|
|
oHashless <- switch $ short 'S'
|
|
|
|
<> long "hashless"
|
|
|
|
<> help "Disable battery hashing (Ignored for now)"
|
|
|
|
<> hidden
|
2019-08-15 05:42:48 +03:00
|
|
|
|
|
|
|
oQuiet <- switch $ short 'q'
|
|
|
|
<> long "quiet"
|
|
|
|
<> help "Quiet"
|
|
|
|
<> hidden
|
|
|
|
|
|
|
|
oVerbose <- switch $ short 'v'
|
|
|
|
<> long "verbose"
|
|
|
|
<> help "Verbose"
|
|
|
|
<> hidden
|
|
|
|
|
|
|
|
oExit <- switch $ short 'x'
|
|
|
|
<> long "exit"
|
2020-02-04 04:27:16 +03:00
|
|
|
<> help "Exit immediately"
|
2019-08-15 05:42:48 +03:00
|
|
|
<> hidden
|
|
|
|
|
2019-10-22 01:32:12 +03:00
|
|
|
oDryRun <- switch $ long "dry-run"
|
|
|
|
<> help "Persist no events and turn off Ames networking"
|
2019-08-15 05:42:48 +03:00
|
|
|
<> hidden
|
|
|
|
|
2020-01-11 01:07:29 +03:00
|
|
|
oDryFrom <- optional $ option auto $ metavar "EVENT"
|
|
|
|
<> long "dry-from"
|
|
|
|
<> help "Dry run from event number"
|
|
|
|
<> hidden
|
|
|
|
|
|
|
|
oTrace <- switch $ short 't'
|
|
|
|
<> long "trace"
|
|
|
|
<> help "Enable tracing"
|
|
|
|
<> hidden
|
2019-08-15 05:42:48 +03:00
|
|
|
|
|
|
|
oLocalhost <- switch $ short 'L'
|
|
|
|
<> long "local"
|
|
|
|
<> help "Localhost-only networking"
|
|
|
|
<> hidden
|
|
|
|
|
|
|
|
oCollectFx <- switch $ short 'f'
|
|
|
|
<> long "collect-fx"
|
2019-08-15 01:35:36 +03:00
|
|
|
<> help "Write effects to disk for debugging"
|
2019-08-15 05:42:48 +03:00
|
|
|
<> hidden
|
2019-08-15 01:18:59 +03:00
|
|
|
|
2019-10-18 03:02:33 +03:00
|
|
|
oOffline <- switch $ short 'O'
|
|
|
|
<> long "offline"
|
|
|
|
<> help "Run without any networking"
|
|
|
|
<> hidden
|
|
|
|
|
2019-10-22 01:26:51 +03:00
|
|
|
oFullReplay <- switch
|
|
|
|
$ long "full-log-replay"
|
|
|
|
<> help "Ignores the snapshot and recomputes state from log"
|
2019-10-22 23:05:58 +03:00
|
|
|
<> hidden
|
2019-10-22 01:26:51 +03:00
|
|
|
|
2019-08-13 07:57:30 +03:00
|
|
|
pure (Opts{..})
|
|
|
|
|
2019-08-21 03:42:53 +03:00
|
|
|
newShip :: Parser Cmd
|
|
|
|
newShip = CmdNew <$> new <*> opts
|
|
|
|
|
2020-05-01 00:21:24 +03:00
|
|
|
runOneShip :: Parser (Run, Opts, Bool)
|
|
|
|
runOneShip = (,,) <$> fmap Run pierPath <*> opts <*> df
|
|
|
|
where
|
|
|
|
df = switch (short 'd' <> long "daemon" <> help "Daemon mode" <> hidden)
|
|
|
|
|
2020-05-03 19:29:00 +03:00
|
|
|
kingOpts :: Parser KingOpts
|
|
|
|
kingOpts = do
|
|
|
|
koSharedHttpPort <-
|
|
|
|
optional
|
|
|
|
$ option auto
|
|
|
|
$ metavar "PORT"
|
|
|
|
<> long "shared-http-port"
|
|
|
|
<> help "HTTP port"
|
|
|
|
<> hidden
|
|
|
|
|
|
|
|
koSharedHttpsPort <-
|
|
|
|
optional
|
|
|
|
$ option auto
|
|
|
|
$ metavar "PORT"
|
|
|
|
<> long "shared-https-port"
|
|
|
|
<> help "HTTPS port"
|
|
|
|
<> hidden
|
|
|
|
|
|
|
|
pure (KingOpts{..})
|
|
|
|
|
2019-08-15 05:42:48 +03:00
|
|
|
runShip :: Parser Cmd
|
2020-05-03 19:29:00 +03:00
|
|
|
runShip = CmdRun <$> kingOpts <*> some runOneShip
|
2019-08-15 05:42:48 +03:00
|
|
|
|
2019-08-21 03:42:53 +03:00
|
|
|
valPill :: Parser Bug
|
2019-08-15 05:42:48 +03:00
|
|
|
valPill = do
|
2019-08-22 02:49:08 +03:00
|
|
|
bPillPath <- strArgument (metavar "PILL" <> help "Path to pill")
|
|
|
|
|
|
|
|
bPrintPil <- switch $ long "print-pill"
|
|
|
|
<> help "Print pill"
|
|
|
|
|
|
|
|
bPrintSeq <- switch $ long "print-boot"
|
|
|
|
<> help "Print boot sequence"
|
|
|
|
|
|
|
|
pure ValidatePill{..}
|
2019-08-21 03:42:53 +03:00
|
|
|
|
2019-09-24 02:42:12 +03:00
|
|
|
keyfilePath :: Parser FilePath
|
|
|
|
keyfilePath = strArgument (metavar "KEYFILE" <> help "Path to key file")
|
|
|
|
|
2019-08-22 03:54:00 +03:00
|
|
|
firstEv :: Parser Word64
|
|
|
|
firstEv = option auto $ long "first"
|
|
|
|
<> metavar "FST"
|
|
|
|
<> help "starting from event FST"
|
|
|
|
<> value 1
|
2019-08-22 03:29:39 +03:00
|
|
|
|
2019-08-22 03:54:00 +03:00
|
|
|
lastEv :: Parser Word64
|
|
|
|
lastEv = option auto $ long "last"
|
|
|
|
<> metavar "LAS"
|
2020-01-11 01:07:29 +03:00
|
|
|
<> help "ending with event LAS"
|
2019-08-22 03:54:00 +03:00
|
|
|
<> value maxBound
|
|
|
|
|
|
|
|
checkEvs :: Parser Bug
|
|
|
|
checkEvs = ValidateEvents <$> pierPath <*> firstEv <*> lastEv
|
|
|
|
|
|
|
|
checkFx :: Parser Bug
|
|
|
|
checkFx = ValidateFX <$> pierPath <*> firstEv <*> lastEv
|
2019-08-22 03:29:39 +03:00
|
|
|
|
2020-01-11 01:07:29 +03:00
|
|
|
replayEvs :: Parser Bug
|
|
|
|
replayEvs = ReplayEvents <$> pierPath <*> lastEv
|
|
|
|
|
2019-08-30 02:48:46 +03:00
|
|
|
browseEvs :: Parser Bug
|
|
|
|
browseEvs = EventBrowser <$> pierPath
|
|
|
|
|
2019-09-20 01:40:23 +03:00
|
|
|
checkDawn :: Parser Bug
|
2019-09-24 02:42:12 +03:00
|
|
|
checkDawn = CheckDawn <$> keyfilePath
|
2019-09-20 01:40:23 +03:00
|
|
|
|
2019-08-21 03:42:53 +03:00
|
|
|
bugCmd :: Parser Cmd
|
|
|
|
bugCmd = fmap CmdBug
|
|
|
|
$ subparser
|
|
|
|
$ command "validate-pill"
|
|
|
|
( info (valPill <**> helper)
|
|
|
|
$ progDesc "Validate a pill file."
|
|
|
|
)
|
|
|
|
<> command "collect-all-fx"
|
|
|
|
( info (allFx <**> helper)
|
|
|
|
$ progDesc "Replay entire event log, collecting all effects"
|
|
|
|
)
|
2019-08-22 03:29:39 +03:00
|
|
|
<> command "validate-events"
|
|
|
|
( info (checkEvs <**> helper)
|
|
|
|
$ progDesc "Parse all data in event log"
|
|
|
|
)
|
2019-08-30 02:48:46 +03:00
|
|
|
<> command "event-browser"
|
|
|
|
( info (browseEvs <**> helper)
|
|
|
|
$ progDesc "Interactively view (and prune) event log"
|
|
|
|
)
|
2019-08-22 03:54:00 +03:00
|
|
|
<> command "validate-effects"
|
|
|
|
( info (checkFx <**> helper)
|
|
|
|
$ progDesc "Parse all data in event log"
|
|
|
|
)
|
2020-01-11 01:07:29 +03:00
|
|
|
<> command "partial-replay"
|
|
|
|
( info (replayEvs <**> helper)
|
|
|
|
$ progDesc "Replay up to N events"
|
|
|
|
)
|
2019-09-20 01:40:23 +03:00
|
|
|
<> command "dawn"
|
|
|
|
( info (checkDawn <**> helper)
|
|
|
|
$ progDesc "Test run dawn"
|
|
|
|
)
|
2019-10-02 23:55:30 +03:00
|
|
|
<> command "comet"
|
|
|
|
( info (pure CheckComet)
|
|
|
|
$ progDesc "Shows the list of stars accepting comets"
|
|
|
|
)
|
2019-08-21 03:42:53 +03:00
|
|
|
|
2019-09-18 10:24:10 +03:00
|
|
|
conCmd :: Parser Cmd
|
2019-12-17 19:55:10 +03:00
|
|
|
conCmd = CmdCon <$> pierPath
|
2019-09-18 10:24:10 +03:00
|
|
|
|
2019-08-21 03:42:53 +03:00
|
|
|
allFx :: Parser Bug
|
|
|
|
allFx = do
|
2019-08-22 02:49:08 +03:00
|
|
|
bPierPath <- strArgument (metavar "PIER" <> help "Path to pier")
|
|
|
|
pure CollectAllFX{..}
|
2019-08-15 05:42:48 +03:00
|
|
|
|
2019-08-13 07:57:30 +03:00
|
|
|
cmd :: Parser Cmd
|
|
|
|
cmd = subparser
|
2019-08-15 05:42:48 +03:00
|
|
|
$ command "new" ( info (newShip <**> helper)
|
|
|
|
$ progDesc "Boot a new ship."
|
|
|
|
)
|
|
|
|
<> command "run" ( info (runShip <**> helper)
|
|
|
|
$ progDesc "Run an existing ship."
|
|
|
|
)
|
2019-08-21 03:42:53 +03:00
|
|
|
<> command "bug" ( info (bugCmd <**> helper)
|
|
|
|
$ progDesc "Run a debugging sub-command."
|
2019-08-15 05:42:48 +03:00
|
|
|
)
|
2019-09-18 10:24:10 +03:00
|
|
|
<> command "con" ( info (conCmd <**> helper)
|
|
|
|
$ progDesc "Connect a terminal to a running urbit."
|
|
|
|
)
|