Skip to content

Latest commit

 

History

History

multiline

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Multiline Example

Demonstrates how to write more detailed help messages.

This example was generated with:

$ bashly init
# ... now edit src/bashly.yml to match the example ...
$ bashly generate

bashly.yml

name: multi
help: |-
  Multiline test
  
  This is a multiline test example. Long lines are going to be properly wrapped at the 80 character mark.

version: 0.1.0

commands:
- name: multiline
  
  # Using the YAML multiline marker allows you to define help messages with 
  # multiple lines
  help: |-
    Do some multiline work.

    This is a long process and takes time, therefore it takes a lot of lines to describe and this line is particularly long.

    But - not all hope is lost. Bashly should respect newlines and word-wrap long lines properly at the 80 character mark.

  args:
  - name: my_arg
    help: |-
      Argument with multiline.

      Once again we gather here to prepare some long lines that will most likely seem silly to anyone who reads them.

      But, it is just needed for testing - otherwise, it will not only be silly, but it will also be buggy!

  flags:
  - long: --long
    help: |-
      Long flag with long text.

      Finally, this will be the last multiline string we type (hopefully), but once we are done with this, we will be done with all.

- name: regular
  help: Standard help line

  args:
  - name: repo
    help: Repository name

examples:
  - |-
    Examples can also use multiple lines. This can be useful if we need to explain the example, for instance like we are doing here:

      multi multiline --flag

environment_variables:
- name: multi_vitamin
  help: |-
    Environment variables can also use multiple lines. This can be useful if we need to explain - in excruciating detail - what the environment variable is used for.

Output

$ ./multi

multi - Multiline test

Usage:
  multi COMMAND
  multi [COMMAND] --help | -h
  multi --version | -v

Commands:
  multiline   Do some multiline work.
  regular     Standard help line


$ ./multi -h

multi

  Multiline test
  
  This is a multiline test example. Long lines are going to be properly wrapped
  at the 80 character mark.

Usage:
  multi COMMAND
  multi [COMMAND] --help | -h
  multi --version | -v

Commands:
  multiline   Do some multiline work.
  regular     Standard help line

Options:
  --help, -h
    Show this help

  --version, -v
    Show version number

Environment Variables:
  MULTI_VITAMIN
    Environment variables can also use multiple lines. This can be useful if we
    need to explain - in excruciating detail - what the environment variable is
    used for.

Examples:
  Examples can also use multiple lines. This can be useful if we need to explain
  the example, for instance like we are doing here:
  
    multi multiline --flag


$ ./multi multiline

# This file is located at 'src/multiline_command.sh'.
# It contains the implementation for the 'multi multiline' command.
# The code you write here will be wrapped by a function named 'multi_multiline_command()'.
# Feel free to edit this file; your changes will persist when regenerating.
args: none

environment variables:
- $MULTI_VITAMIN = 

$ ./multi multiline -h

multi multiline

  Do some multiline work.
  
  This is a long process and takes time, therefore it takes a lot of lines to
  describe and this line is particularly long.
  
  But - not all hope is lost. Bashly should respect newlines and word-wrap long
  lines properly at the 80 character mark.

Usage:
  multi multiline [MY_ARG] [OPTIONS]
  multi multiline --help | -h

Options:
  --long
    Long flag with long text.
    
    Finally, this will be the last multiline string we type (hopefully), but
    once we are done with this, we will be done with all.

  --help, -h
    Show this help

Arguments:
  MY_ARG
    Argument with multiline.
    
    Once again we gather here to prepare some long lines that will most likely
    seem silly to anyone who reads them.
    
    But, it is just needed for testing - otherwise, it will not only be silly,
    but it will also be buggy!