| Copyright | (c) Dennis Gosnell 2018 |
|---|---|
| License | BSD3 |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Termonad
Description
This module exposes Termonad's basic configuration options, as well as defaultMain, startWithCliArgs, and start.
If you want to configure Termonad, please take a look at Termonad.Config.
Synopsis
- defaultMain :: TMConfig -> IO ()
- startWithCliArgs :: TMConfig -> IO ()
- start :: TMConfig -> IO ()
- module Termonad.Config
Documentation
defaultMain :: TMConfig -> IO () Source #
Run Termonad with the given TMConfig.
This function will check if there is a ~/.config/termonad/termonad.hs file
and a ~/.cache/termonad/termonad-linux-x86_64 binary. Termonad will
perform different actions based on whether or not these two files exist.
Here are the four different possible actions based on the existence of these two files.
~/.config/termonad/termonad.hsexists,~/.cache/termonad/termonad-linux-x86_64existsThe timestamps of these two files are checked. If the
~/.config/termonad/termonad.hsfile has been modified after the~/.cache/termonad/termonad-linux-x86_64binary, then Termonad will use GHC to recompile the~/.config/termonad/termonad.hsfile, producing a new binary at~/.cache/termonad/termonad-linux-x86_64. This new binary will be re-executed. TheTMConfigpassed to thisdefaultMainwill be effectively thrown away, however all command line options will be passed on to this new Termonad process.If GHC fails to recompile the
~/.config/termonad/termonad.hsfile, then Termonad will just executestartWithCliArgswith theTMConfigpassed in.If the
~/.cache/termonad/termonad-linux-x86_64binary has been modified after the~/.config/termonad/termonad.hsfile, then Termonad will re-exec the~/.cache/termonad/termonad-linux-x86_64binary. TheTMConfigpassed to thisdefaultMainwill be effectively thrown away, however all command line options will be passed on to this new Termonad process.~/.config/termonad/termonad.hsexists,~/.cache/termonad/termonad-linux-x86_64does not existTermonad will use GHC to recompile the
~/.config/termonad/termonad.hsfile, producing a new binary at~/.cache/termonad/termonad-linux-x86_64. This new binary will be re-executed. TheTMConfigpassed to thisdefaultMainwill be effectively thrown away, however all command line options will be passed on to this new Termonad process.If GHC fails to recompile the
~/.config/termonad/termonad.hsfile, then Termonad will just executestartWithCliArgswith theTMConfigpassed in.~/.config/termonad/termonad.hsdoes not exist,~/.cache/termonad/termonad-linux-x86_64existsTermonad will ignore the
~/.cache/termonad/termonad-linux-x86_64binary and just runstartWithCliArgswith theTMConfigpassed to this function.~/.config/termonad/termonad.hsdoes not exist,~/.cache/termonad/termonad-linux-x86_64does not existTermonad will run
startWithCliArgswith theTMConfigpassed to this function.
Other notes:
- That the locations of
~/.config/termonad/termonad.hsand~/.cache/termonad/termonad-linux-x86_64may differ depending on your system. - In your own
~/.config/termonad/termonad.hsfile, you can use eitherdefaultMainorstartWithCliArgs. As long as you always execute the system-widetermonadbinary (instead of the binary produced as~/.cache/termonad/termonad-linux-x86_64), the effect should be similar. - If you directly run the cached termonad binary (e.g.
~/.cache/termonad/termonad-linux-x86_64) instead of the system-installed Termonad binary (e.g./usr/bin/termonad), the Termonad will recompile the the configuration file~/.config/termonad/termonad.hsaccording to the above logic (while possibly overwriting the executable file for the binary you're currently running), but it will not re-exec into the newly builttermonadbinary. - When running the system-wide
termonadbinary, the initialTMConfigthat gets passed into this function comes fromtmConfigFromPreferencesFile. As stated above, this initialTMConfiggets ignored if users have a~/.config/termonad/termonad.hsfile that gets recompiled and re-execed.
End users generally call defaultMain in their
~/.config/termonad/termonad.hs file.
defaultMain interally calls startWithCliArgs, which parses CLI arguments
and combines them with the passed-in TMConfig. startWithCliArgs then
internally calls start.
If you don't want the re-compiling and re-exec functionality, you can directly
use startWithCliArgs. If you also don't want the CLI argument parsing
functionality, you can directly use start.
startWithCliArgs :: TMConfig -> IO () Source #
Run Termonad with the given TMConfig.
Do not perform any of the recompilation operations that the defaultMain
function does.
This function does parse command line arguments, and then calls start.
start :: TMConfig -> IO () Source #
Run Termonad with the given TMConfig.
Do not perform any of the recompilation operations that the defaultMain
function does.
This function does not parse command line arguments.
module Termonad.Config