Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Dependencies Example

Demonstrates how to require your script's user to have certain dependencies (commands) installed prior to using your script.

This example was generated with:

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

bashly.yml

name: cli
help: Sample application that requires dependencies
version: 0.1.0

commands:
- name: download
  help: Download something

  # By defining dependencies, the generated script will be halted (with a
  # friendly error message) unless all of these commands exist in the host
  # system.
  dependencies:
  - git
  - curl
  - dos
  - netscape

- name: upload
  help: Upload something

  # Dependencies can also be defined as a hash of 'command: message' pairs.
  # The message can use colors from the colors library (bashly add colors).
  dependencies:
    mini-docker: install with $(green gem install mini-docker)
    multi-docker: install with $(blue gem install multi-docker)
    docker: visit https://docker.com for more information

Output

$ ./cli download

missing dependency: dos
missing dependency: netscape

$ ./cli upload

missing dependency: mini-docker
install with gem install mini-docker

missing dependency: multi-docker
install with gem install multi-docker