• Beta
Bash UX
  • 10 Jul 2020
  • 2 Minutes To Read
  • Share
  • Dark
    Light

Bash UX

  • Share
  • Dark
    Light

Supported methods

The following UX elements are supported by the Bash SDK:

  • Format
  • Print
  • ProgressBars
  • Spinners

Different from the other Ops Platform SDKs, Bash has the UX elements at the top level to improve usability of these elements. For example, print is accessed by cto-ai print instead of cto-ai ux print.

Format

Formats text with rich styling

USAGE:

 ctoai format [SUBCOMMAND]

SUBCOMMANDS:

bold      Formats the provided text as boldface
italic    Formats the provided text as italics

Bold:

Formats the provided text as boldface

USAGE:

ctoai format bold [text]...

EXAMPLE:

ctoai print We are $(ctoai format bold "permanently deleting") the existing cluster

Italic:

Formats the provided text as italics. Note: italic support in terminals is limited.

USAGE:

bash-sdk format italic [text]...

EXAMPLE:

ctoai print We hope you have a $(ctoai format italic very) good experience with CTO.ai

Print

Displays text to the user.

USAGE:

cto-ai print [text]...

ARGS:

<text>...    Text to be displayed

Example:

response=cto-ai print This is text
echo $response

Output:

This is text

Progressbar

Displays progress bars to the user.

USAGE:

cto-ai progressbar [SUBCOMMAND]

SUBCOMMAND:

advance    Advances the current progress bar
start      Starts a new progress bar
stop       Stops the current progress bar

Advance:

USAGE:

cto-ai progressbar advance [increment]

ARGS:

<increment>    Length to increment the progress bar by

Start:

USAGE:

cto-ai progressbar start [OPTIONS] --length <LENGTH>

OPTIONS:

-i, --initial <INITIAL>    Initial filled length of the progress bar
-l, --length <LENGTH>      Sets the full length of the progress bar
-m, --message <MESSAGE>    Descriptive message accompanying the progress bar

Stop:

USAGE:

cto-ai progressbar stop [OPTIONS]

OPTIONS:

-m, --message <MESSAGE>    Message to be displayed with the complete progress bar

Example:

cto-ai progressbar start --length=1 -m='Downloading...'
[excluded snippet]
cto-ai progressbar advance 1
[excluded snippet]
cto-ai progressbar advance 1
cto-ai progressbar stop -m='Done!'

Output:

[Progress bar that starts at 0/2, increments, and finishes]

Spinner

Displays spinners to the user

USAGE:

cto-ai spinner [SUBCOMMAND]

SUBCOMMAND:

start      Starts a new spinner
stop       Stops the current spinner

Start:

USAGE:

cto-ai progressbar start --message <MESSAGE>

OPTIONS:

-m, --message <MESSAGE>    Message to be displayed with the spinner

Stop:

USAGE:

cto-ai progressbar stop --message <MESSAGE>

OPTIONS:

-m, --message <MESSAGE>    Message to be displayed with the stopped spinner [default: Done!]

Example:

cto-ai spinner start -m='Initializing...'
[excluded snippet]
cto-ai spinner stop

Output:

[Spinner starts and finishes]

🚀 What's next?

  • If you want to explore the options offered by our SDKs, go to the Bash SDK page.
  • To see which prompts we offer for this SDK, you can go to Bash Prompts page.
Was This Article Helpful?