ganeti-3.1: Cluster-based virtualization management software
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ganeti.HTools.CLI

Contents

Description

Implementation of command-line functions.

This module holds the common command-line related functions for the binaries, separated into this module since Ganeti.Utils is used in many other places and this is more IO oriented.

Synopsis

Documentation

data Options #

Command line options structure.

Constructors

Options 

Fields

Instances

Instances details
Show Options # 
Instance details

Defined in Ganeti.HTools.CLI

Methods

showsPrec :: Int -> Options -> ShowS

show :: Options -> String

showList :: [Options] -> ShowS

StandardOptions Options # 
Instance details

Defined in Ganeti.HTools.CLI

type OptType = GenericOptType Options #

Abbreviation for the option type.

defaultOptions :: Options #

Default values for the command line options.

parseOpts #

Arguments

:: [String]

The command line arguments

-> String

The program name

-> [OptType]

The supported command line options

-> [ArgCompletion]

The supported command line arguments

-> IO (Options, [String])

The resulting options and leftover arguments

Wrapper over parseOpts with our custom options.

parseOptsInner :: StandardOptions a => a -> [String] -> String -> [GenericOptType a] -> [ArgCompletion] -> Either (ExitCode, String) (a, [String]) #

Inner parse options. The arguments are similar to parseOpts, but it returns either a Left composed of exit code and message, or a Right for the success case.

parseYesNo #

Arguments

:: Bool

Default value (when we get a Nothing)

-> Maybe String

Parameter value

-> Result Bool

Resulting boolean value

Helper for parsing a yes/no command line flag.

parseISpecString :: String -> String -> Result RSpec #

shTemplate :: String #

A shell script template for autogenerated scripts.

maybeSaveCommands #

Arguments

:: String

Informal description

-> Options 
-> String

commands

-> IO () 

Optionally show or save a list of commands

maybePrintNodes #

Arguments

:: Maybe [String]

The field list

-> String

Informational message

-> ([String] -> String)

Function to generate the listing

-> IO () 

Optionally print the node list.

maybePrintInsts #

Arguments

:: Bool

Whether to print the instance list

-> String

Type of the instance map (e.g. initial)

-> String

The instance data

-> IO () 

Optionally print the instance list.

maybeShowWarnings #

Arguments

:: [String]

The warning messages

-> IO () 

Function to display warning messages from parsing the cluster state.

printKeys #

Arguments

:: String

Prefix to printed variables

-> [(String, String)]

List of (key, value) pairs to be printed

-> IO () 

Format a list of key, value as a shell fragment.

printFinal #

Arguments

:: String

Prefix to printed variable

-> Bool

Whether output should be machine readable; note: if not, there is nothing to print

-> IO () 

Prints the final OK marker in machine readable output.

setNodeStatus :: Options -> List -> IO List #

Set node properties based on command line options.

The options

genOLuxiSocket :: String -> OptType #

oShowHelp :: StandardOptions a => GenericOptType a #

Option to request help output.

oShowVer :: StandardOptions a => GenericOptType a #

Option to request version information.

oShowComp :: StandardOptions a => GenericOptType a #

Option to request completion information

genericOpts :: [GenericOptType Options] #

Generic options.