mirror of
https://github.com/srid/rib.git
synced 2024-11-30 03:45:00 +03:00
Rib.App: fix ghcid not resetting cmdargs state
The `modes` need to be inside a function, apparently.
This commit is contained in:
parent
bc380f5869
commit
aae2906737
@ -5,9 +5,7 @@ Credit for this image: https://www.svgrepo.com/svg/24439/ribs
|
||||
-->
|
||||
<img src="https://raw.githubusercontent.com/srid/rib/master/example/content/static/ribs.svg?sanitize=true" width="150" />
|
||||
|
||||
Rib is a static site generator written in Haskell using sensible technologies
|
||||
like `Shake`, `Lucid` and `Clay`. It is nearly done but still a work in progress
|
||||
and will soon be ready for general use.
|
||||
Rib is a static site generator written in Haskell that reuses existing tools (`Shake`, `Lucid` and `Clay`) and is thus non-monolithic. It is nearly done but still a work in progress and will soon be ready for general use.
|
||||
|
||||
## Example
|
||||
|
||||
@ -25,7 +23,9 @@ example/Main.hs 15 6 90
|
||||
-------------------------------------------------------------------------------
|
||||
```
|
||||
|
||||
With Rib you do not have to deal with the less powerful template engines or
|
||||
(See `Rib.Simple` if you need further customization.)
|
||||
|
||||
With Rib you do not have to deal with less powerful template engines or
|
||||
write raw HTML/CSS by hand. Do everything in Haskell, and concisely at that!
|
||||
|
||||
To get the example site up and running run:
|
||||
|
12
ghcid
12
ghcid
@ -1,7 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
RIB=$(cd `dirname $0` && pwd)
|
||||
MAIN="Main.hs"
|
||||
# The path to git checkout of github.com/srid/rib.
|
||||
# As this script resides under this repo, it is simply the parent directory of it.
|
||||
RIBDIR=$(cd `dirname $0` && pwd)
|
||||
|
||||
nix-shell ${RIB}/default.nix --run \
|
||||
"ghcid --reload=${MAIN} -c 'ghci -Wall -i${RIB}/src ${MAIN}' -T 'System.Environment.withArgs [\"serve\", \"-w\"] Main.main'"
|
||||
# If your program file is Main.hs set this to Main
|
||||
MAIN="Main"
|
||||
|
||||
nix-shell ${RIBDIR}/default.nix --run \
|
||||
"ghcid --reload=${MAIN}.hs -c 'ghci -Wall -i${RIBDIR}/src ${MAIN}.hs' -T 'System.Environment.withArgs [\"serve\", \"-w\"] ${MAIN}.main'"
|
||||
|
@ -12,7 +12,7 @@ import Control.Concurrent (threadDelay)
|
||||
import Control.Concurrent.Async (concurrently_)
|
||||
import Control.Monad (forever, void, when)
|
||||
|
||||
import System.Console.CmdArgs (Data, Typeable, auto, cmdArgs, help, modes, (&=))
|
||||
import System.Console.CmdArgs
|
||||
import System.FSNotify (watchTree, withManager)
|
||||
|
||||
import qualified Rib.Server as Server
|
||||
@ -25,23 +25,22 @@ data App
|
||||
| Generate { force :: Bool }
|
||||
deriving (Data,Typeable,Show,Eq)
|
||||
|
||||
cli :: App
|
||||
cli = modes
|
||||
[ Watch
|
||||
&= help "Watch for changes and generate"
|
||||
, Serve
|
||||
{ port = 8080 &= help "Port to bind to"
|
||||
, watch = False &= help "Watch in addition to serving generated files"
|
||||
} &= help "Serve the generated site"
|
||||
, Generate
|
||||
{ force = False &= help "Force generation of all files"
|
||||
} &= help "Generate the site"
|
||||
&= auto -- Generate is the default command.
|
||||
]
|
||||
|
||||
-- | CLI entry point for running the Rib app
|
||||
run :: S.Settings page -> IO ()
|
||||
run cfg = runWith cfg =<< cmdArgs cli
|
||||
run cfg = runWith cfg =<< cmdArgs ribCli
|
||||
where
|
||||
ribCli = modes
|
||||
[ Watch
|
||||
&= help "Watch for changes and generate"
|
||||
, Serve
|
||||
{ port = 8080 &= help "Port to bind to"
|
||||
, watch = False &= help "Watch in addition to serving generated files"
|
||||
} &= help "Serve the generated site"
|
||||
, Generate
|
||||
{ force = False &= help "Force generation of all files"
|
||||
} &= help "Generate the site"
|
||||
&= auto -- Generate is the default command.
|
||||
]
|
||||
|
||||
-- | Like `run` but uses the given `App` mode instead of reading it from CLI
|
||||
-- arguments.
|
||||
|
Loading…
Reference in New Issue
Block a user