feat: documentation and box layout
This commit is contained in:
parent
cd5de79e24
commit
e1f2d5b5ef
6 changed files with 68 additions and 68 deletions
|
@ -6,7 +6,7 @@ import qualified Sudoku
|
|||
import qualified Sudoku.Solve as Solve
|
||||
import qualified Sudoku.Render as Render
|
||||
import Sudoku.State (State)
|
||||
import Options.Applicative (subparser, command, info, Parser, progDesc, execParser)
|
||||
import Options.Applicative (subparser, command, info, Parser, progDesc, execParser, idm, customExecParser, ParserPrefs, showHelpOnEmpty, prefs)
|
||||
import System.Exit (exitFailure)
|
||||
|
||||
data Mode
|
||||
|
@ -21,7 +21,7 @@ parseMode = subparser
|
|||
|
||||
main :: IO ()
|
||||
main = do
|
||||
mode <- execParser (info parseMode mempty)
|
||||
mode <- customExecParser optparsePreferences (info parseMode idm)
|
||||
input <- Text.getContents
|
||||
sudoku <- case runParser Sudoku.parse "<stdin>" input of
|
||||
Left errorBundle -> (Text.putStr . Text.pack . errorBundlePretty $ errorBundle) >> exitFailure
|
||||
|
@ -34,3 +34,6 @@ main = do
|
|||
|
||||
in Render.hints hints
|
||||
|
||||
optparsePreferences :: ParserPrefs
|
||||
optparsePreferences = prefs showHelpOnEmpty
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue