shh-extras-0.1.0.0: Utility functions for using shh

Safe HaskellNone
LanguageHaskell2010

Shh.Prompt

Description

This module provides utility functions for creating prompts. Useful if you want to use Shh and GHCi as a shell.

Synopsis

Documentation

type PromptFn = [String] -> Int -> IO String Source #

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$ "