Skip to content

Latest commit

 

History

History

hooks

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Before/After Hooks Example

This example demonstrates how to run common code before or after executing any command.

This example was generated with:

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

bashly.yml

name: hooks
help: Sample application that uses before/after hooks
version: 0.1.0

flags:
- long: --debug
  short: -d
  help: Enable debug mode

Output

$ ./hooks

==[ Before Hook Called ]==
args: none
# this file is located in 'src/root_command.sh'
# you can edit it freely and regenerate (it will not be overwritten)
args: none
==[ After Hook Called ]==

$ ./hooks --debug

==[ Before Hook Called ]==
args:
- ${args[--debug]} = 1
# this file is located in 'src/root_command.sh'
# you can edit it freely and regenerate (it will not be overwritten)
args:
- ${args[--debug]} = 1
==[ After Hook Called ]==