Skip to content

Latest commit

 

History

History

git-like

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Git Example

Demonstrates how to configure sub-commands, similar to what git does (git status, git commit, etc.).

This example was generated with:

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

bashly.yml

name: git
help: Git example
version: 0.1.0

commands:
- name: status
  alias: s*
  help: Show repository status

- name: commit
  alias: c*
  help: Commit changes

  flags:
  - long: --message
    short: -m
    arg: MESSAGE
    help: Commit message

  - long: --all
    short: -a
    help: Automatically stage files

Output

$ ./git

git - Git example

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

Commands:
  status   Show repository status
  commit   Commit changes


$ ./git -h

git - Git example

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

Commands:
  status   Show repository status
  commit   Commit changes

Options:
  --help, -h
    Show this help

  --version, -v
    Show version number


$ ./git s

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

$ ./git status -h

git status - Show repository status

Alias: s*

Usage:
  git status
  git status --help | -h

Options:
  --help, -h
    Show this help


$ ./git commit -h

git commit - Commit changes

Alias: c*

Usage:
  git commit [OPTIONS]
  git commit --help | -h

Options:
  --message, -m MESSAGE
    Commit message

  --all, -a
    Automatically stage files

  --help, -h
    Show this help


$ ./git commit -a -m "initial commit"

# This file is located at 'src/commit_command.sh'.
# It contains the implementation for the 'git commit' command.
# The code you write here will be wrapped by a function named 'git_commit_command()'.
# Feel free to edit this file; your changes will persist when regenerating.
args:
- ${args[--all]} = 1
- ${args[--message]} = initial commit