NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
| #!/bin/sh | |
| # An hook script to verify changes to be committed do not contain | |
| # any 'FIXME:' comments. Called by "git commit" with no arguments. | |
| # | |
| # The hook should exit with non-zero status after issuing an appropriate | |
| # message if it stops the commit. | |
| # | |
| # To bypass this hook, use the "--no-verify" parameter when committing. |
| #!/usr/bin/env python | |
| import argparse | |
| def main(command_line=None): | |
| parser = argparse.ArgumentParser('Blame Praise app') | |
| parser.add_argument( | |
| '--debug', | |
| action='store_true', | |
| help='Print debug info' |
| __author__ = 'Vineeth' | |
| ''' | |
| This tutorial code block lets you know about a design pattern for command line interface tools | |
| To illustrate i will take an example. The command line tool consists of a main command and sub commands | |
| Each command and sub command contains of switches or arguments | |
| I will take the main command name as "main_command" | |
| And sub commands as "sub_command_1", "sub_command_2", "sub_command_3" so on |
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].