Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module provides utility functions for creating prompts. Useful if you want to use Shh and GHCi as a shell.
Documentation
= [String] | names of the modules currently in scope |
-> Int | line number (as referenced in compiler messages) of the current prompt |
-> IO String |
The type of GHCi prompt functions
formatPrompt :: String -> PromptFn Source #
Format a prompt line suitable for use with Shh.
This also calls initInteractive
, which is required for a good
user experience when using shh
as a shell.
The format of the prompt uses the "%" character as an escape mechanism, allowing for the substitution of various values into the prompt.
%% -> %
%u -> current user
%w -> current directory
%h -> hostname
%t -> HH:MM:SS
Use it by importing Shh.Prompt
in your .ghci
or $SHH_DIR/init.ghci
files and :set prompt-function formatPrompt "%u@%h:%w$ "