mirror of
https://github.com/swarm-game/swarm.git
synced 2025-01-07 16:55:59 +03:00
parent
bd552e3615
commit
c6288e53cb
@ -49,17 +49,16 @@ cliParser =
|
|||||||
<> help ("Set the address of " <> replace "-" " " n <> ". Default no link.")
|
<> help ("Set the address of " <> replace "-" " " n <> ". Default no link.")
|
||||||
)
|
)
|
||||||
in PageAddress <$> opt "entities-page" <*> opt "commands-page" <*> opt "capabilities-page" <*> opt "recipes-page"
|
in PageAddress <$> opt "entities-page" <*> opt "commands-page" <*> opt "capabilities-page" <*> opt "recipes-page"
|
||||||
cheatsheet :: Parser (Maybe SheetType)
|
cheatsheet :: Parser SheetType
|
||||||
cheatsheet =
|
cheatsheet =
|
||||||
Data.Foldable.asum
|
Data.Foldable.asum
|
||||||
[ pure Nothing
|
[ flag' Entities (long "entities" <> help "Generate entities page (uses data from entities.yaml)")
|
||||||
, Just Entities <$ switch (long "entities" <> help "Generate entities page (uses data from entities.yaml)")
|
, flag' Terrain (long "terrain" <> help "Generate terrain page (uses data from terrains.yaml)")
|
||||||
, Just Terrain <$ switch (long "terrain" <> help "Generate terrain page (uses data from terrains.yaml)")
|
, flag' Recipes (long "recipes" <> help "Generate recipes page (uses data from recipes.yaml)")
|
||||||
, Just Recipes <$ switch (long "recipes" <> help "Generate recipes page (uses data from recipes.yaml)")
|
, flag' Capabilities (long "capabilities" <> help "Generate capabilities page (uses entity map)")
|
||||||
, Just Capabilities <$ switch (long "capabilities" <> help "Generate capabilities page (uses entity map)")
|
, flag' Commands (long "commands" <> help "Generate commands page (uses constInfo, constCaps and inferConst)")
|
||||||
, Just Commands <$ switch (long "commands" <> help "Generate commands page (uses constInfo, constCaps and inferConst)")
|
, flag' CommandMatrix (long "matrix" <> help "Generate commands matrix page")
|
||||||
, Just CommandMatrix <$ switch (long "matrix" <> help "Generate commands matrix page")
|
, flag' Scenario (long "scenario" <> help "Generate scenario schema page")
|
||||||
, Just Scenario <$ switch (long "scenario" <> help "Generate scenario schema page")
|
|
||||||
]
|
]
|
||||||
|
|
||||||
cliInfo :: ParserInfo GenerateDocs
|
cliInfo :: ParserInfo GenerateDocs
|
||||||
|
@ -72,7 +72,7 @@ data GenerateDocs where
|
|||||||
-- | List of special key names recognized by 'Swarm.Language.Syntax.Key' command
|
-- | List of special key names recognized by 'Swarm.Language.Syntax.Key' command
|
||||||
SpecialKeyNames :: GenerateDocs
|
SpecialKeyNames :: GenerateDocs
|
||||||
-- | Cheat sheets for inclusion on the Swarm wiki.
|
-- | Cheat sheets for inclusion on the Swarm wiki.
|
||||||
CheatSheet :: PageAddress -> Maybe SheetType -> GenerateDocs
|
CheatSheet :: PageAddress -> SheetType -> GenerateDocs
|
||||||
-- | List command introductions by tutorial
|
-- | List command introductions by tutorial
|
||||||
TutorialCoverage :: GenerateDocs
|
TutorialCoverage :: GenerateDocs
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
@ -62,28 +62,26 @@ data SheetType = Entities | Terrain | Commands | CommandMatrix | Capabilities |
|
|||||||
|
|
||||||
-- * Functions
|
-- * Functions
|
||||||
|
|
||||||
makeWikiPage :: PageAddress -> Maybe SheetType -> IO ()
|
makeWikiPage :: PageAddress -> SheetType -> IO ()
|
||||||
makeWikiPage address s = case s of
|
makeWikiPage address s = case s of
|
||||||
Nothing -> error "Not implemented for all Wikis"
|
Commands -> T.putStrLn commandsPage
|
||||||
Just st -> case st of
|
CommandMatrix -> case pandocToText commandsMatrix of
|
||||||
Commands -> T.putStrLn commandsPage
|
Right x -> T.putStrLn x
|
||||||
CommandMatrix -> case pandocToText commandsMatrix of
|
Left x -> error $ T.unpack x
|
||||||
Right x -> T.putStrLn x
|
Capabilities -> simpleErrorHandle $ do
|
||||||
Left x -> error $ T.unpack x
|
entities <- loadEntities
|
||||||
Capabilities -> simpleErrorHandle $ do
|
sendIO $ T.putStrLn $ capabilityPage address entities
|
||||||
entities <- loadEntities
|
Entities -> simpleErrorHandle $ do
|
||||||
sendIO $ T.putStrLn $ capabilityPage address entities
|
entities <- loadEntities
|
||||||
Entities -> simpleErrorHandle $ do
|
sendIO $ T.putStrLn $ entitiesPage address (Map.elems $ entitiesByName entities)
|
||||||
entities <- loadEntities
|
Terrain -> simpleErrorHandle $ do
|
||||||
sendIO $ T.putStrLn $ entitiesPage address (Map.elems $ entitiesByName entities)
|
terrains <- loadTerrain
|
||||||
Terrain -> simpleErrorHandle $ do
|
sendIO . T.putStrLn . T.unlines . map showT . Map.elems $ terrainByName terrains
|
||||||
terrains <- loadTerrain
|
Recipes -> simpleErrorHandle $ do
|
||||||
sendIO . T.putStrLn . T.unlines . map showT . Map.elems $ terrainByName terrains
|
entities <- loadEntities
|
||||||
Recipes -> simpleErrorHandle $ do
|
recipes <- loadRecipes entities
|
||||||
entities <- loadEntities
|
sendIO $ T.putStrLn $ recipePage address recipes
|
||||||
recipes <- loadRecipes entities
|
Scenario -> genScenarioSchemaDocs
|
||||||
sendIO $ T.putStrLn $ recipePage address recipes
|
|
||||||
Scenario -> genScenarioSchemaDocs
|
|
||||||
|
|
||||||
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
||||||
-- GENERATE TABLES: COMMANDS, ENTITIES AND CAPABILITIES TO MARKDOWN TABLE
|
-- GENERATE TABLES: COMMANDS, ENTITIES AND CAPABILITIES TO MARKDOWN TABLE
|
||||||
|
Loading…
Reference in New Issue
Block a user