\href{https://travis-ci.org/yargs/cliui}{\texttt{ }} \href{https://coveralls.io/r/yargs/cliui?branch=}{\texttt{ }} \href{https://www.npmjs.com/package/cliui}{\texttt{ }} \href{https://github.com/conventional-changelog/standard-version}{\texttt{ }}

easily create complex multi-\/column command-\/line-\/interfaces.\hypertarget{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14975}{}\doxysection{Example}\label{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14975}

\begin{DoxyCode}{0}
\DoxyCodeLine{var ui = require('cliui')()}
\DoxyCodeLine{}
\DoxyCodeLine{ui.div('Usage: \$0 [command] [options]')}
\DoxyCodeLine{}
\DoxyCodeLine{ui.div(\{}
\DoxyCodeLine{  text: 'Options:',}
\DoxyCodeLine{  padding: [2, 0, 2, 0]}
\DoxyCodeLine{\})}
\DoxyCodeLine{}
\DoxyCodeLine{ui.div(}
\DoxyCodeLine{  \{}
\DoxyCodeLine{    text: "{}-\/f, -\/-\/file"{},}
\DoxyCodeLine{    width: 20,}
\DoxyCodeLine{    padding: [0, 4, 0, 4]}
\DoxyCodeLine{  \},}
\DoxyCodeLine{  \{}
\DoxyCodeLine{    text: "{}the file to load."{} +}
\DoxyCodeLine{      chalk.green("{}(if this description is long it wraps)."{})}
\DoxyCodeLine{    ,}
\DoxyCodeLine{    width: 20}
\DoxyCodeLine{  \},}
\DoxyCodeLine{  \{}
\DoxyCodeLine{    text: chalk.red("{}[required]"{}),}
\DoxyCodeLine{    align: 'right'}
\DoxyCodeLine{  \}}
\DoxyCodeLine{)}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(ui.toString()) }

\end{DoxyCode}


\hypertarget{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14976}{}\doxysection{Layout DSL}\label{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14976}
cliui exposes a simple layout DSL\+:

If you create a single {\ttfamily ui.\+div}, passing a string rather than an object\+:


\begin{DoxyItemize}
\item {\ttfamily \textbackslash{}n}\+: characters will be interpreted as new rows.
\item {\ttfamily \textbackslash{}t}\+: characters will be interpreted as new columns.
\item {\ttfamily \textbackslash{}s}\+: characters will be interpreted as padding.
\end{DoxyItemize}

{\bfseries{as an example...}}


\begin{DoxyCode}{0}
\DoxyCodeLine{var ui = require('./')(\{}
\DoxyCodeLine{  width: 60}
\DoxyCodeLine{\})}
\DoxyCodeLine{}
\DoxyCodeLine{ui.div(}
\DoxyCodeLine{  'Usage: node ./bin/foo.js\(\backslash\)n' +}
\DoxyCodeLine{  '  <regex>\(\backslash\)t  provide a regex\(\backslash\)n' +}
\DoxyCodeLine{  '  <glob>\(\backslash\)t  provide a glob\(\backslash\)t [required]'}
\DoxyCodeLine{)}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(ui.toString()) }

\end{DoxyCode}


{\bfseries{will output\+:}}


\begin{DoxyCode}{0}
\DoxyCodeLine{Usage: node ./bin/foo.js}
\DoxyCodeLine{  <regex>  provide a regex}
\DoxyCodeLine{  <glob>   provide a glob          [required] }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14977}{}\doxysection{Methods}\label{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14977}

\begin{DoxyCode}{0}
\DoxyCodeLine{cliui = require('cliui') }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14978}{}\doxysubsection{cliui(\{width\+: integer\})}\label{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14978}
Specify the maximum width of the UI being generated. If no width is provided, cliui will try to get the current window\textquotesingle{}s width and use it, and if that doesn\textquotesingle{}t work, width will be set to {\ttfamily 80}.\hypertarget{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14979}{}\doxysubsection{cliui(\{wrap\+: boolean\})}\label{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14979}
Enable or disable the wrapping of text in a column.\hypertarget{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14980}{}\doxysubsection{cliui.\+div(column, column, column)}\label{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14980}
Create a row with any number of columns, a column can either be a string, or an object with the following options\+:


\begin{DoxyItemize}
\item {\bfseries{text\+:}} some text to place in the column.
\item {\bfseries{width\+:}} the width of a column.
\item {\bfseries{align\+:}} alignment, {\ttfamily right} or {\ttfamily center}.
\item {\bfseries{padding\+:}} {\ttfamily \mbox{[}top, right, bottom, left\mbox{]}}.
\item {\bfseries{border\+:}} should a border be placed around the div?
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14981}{}\doxysubsection{cliui.\+span(column, column, column)}\label{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14981}
Similar to {\ttfamily div}, except the next row will be appended without a new line being created.\hypertarget{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14982}{}\doxysubsection{cliui.\+reset\+Output()}\label{md_sfcode_node_modules_karma_node_modules_cliui_README_autotoc_md14982}
Resets the UI elements of the current cliui instance, maintaining the values set for {\ttfamily width} and {\ttfamily wrap}. 