37signals/sub — pull request #37 by jeffreyroberts (2013-04-23 05:53:26+00:00)
Title: Sub sub commands

Let me know if there is anything I can do, add, remove, etc..

It's solid, give it a test drive, it rocks

Fixes #7
Fixes #12
Fixes #16
Fixes #22
Fixes #27

Example Multi-level autocompletion for --complete: Fixes #7

[ /sub ] $ sub example advanced fix-7
bar foo
[ /sub ] $ sub example advanced fix-7 foo b
baz bla

Nested "sub-sub-commands": Fixes #22

.
├── bin # contains the main executable for your program
├── completions # (optional) bash/zsh completions
├── libexec # where the subcommand executables are
├───> sub-command-a	# sub command-a directory
├─────> sub-command-b # sub command-a command-b directory
└── share

Example Directory and File Structure: Fixes #22

.
├── bin	# Real Life Example
├── completions	# Directories return help for children
├── libexec	#
├───> sub-example	# sub example (Returns help for example)
├─────> sub-basic	# sub example basic (Directory)
├──────── sub-foreach	# sub example basic foreach (Script)
├──────── sub-files	# sub example basic files (Script)
├────> sub-advanced	# sub example advanced (Directory)
├─────> sub-expert	# sub example advanced expert (Directory)
├──────── sub-case-select # sub example advanced expert case-select (Script)
└── share

Example For Directory Help Helper File: Fixes #22

├── libexec	#
├───> sub-example	# sub example (Returns help for example)
├───── sub-example # Provides area for usage, summary, and help

Example Help Display With sub-sub-commands: Fixes #22

[ /sub ] $ sub help
Usage: sub []

Some useful sub commands are:
commands List all sub commands
-> example Collection of BASH Sub Example Scripts

See 'sub help ' for information on a specific command.

Example Multiple Command w/ Completion: Fixes #22 & Fixes #12

[ /sub ] $ sub example advanced expert case-select --
--break --name

Example Multiple Commands and Flags: Fixes #22

[ /sub ] $ sub example advanced expert case-select --break 3 --name Jeff
-=> Executing Case Select Example
----> Breaking on 3
----> Counter is called Jeff
------> The Jeff is 0
------> The Jeff is 1
------> The Jeff is 2
- Finished...

Example File Completion: Fixes #16 & Fixes #27

[ /sub ] $ sub example basic files
.git/ .gitmodules README.md completions/ plugins/ share/
.gitignore LICENSE bin/ libexec/ prepare.sh