This is just to show how to use argparse to create a git like command line structure. It does not have any actual functionality right now.
Output of --help
is shown below in this file. The actual code with argparse
will be in the other file of this gist.
% python git_clone_cmd.py clone --help
usage: git_clone_cmd.py clone [-h] [--template <template_directory>] [--local]
<repository> [<directory>]
positional arguments:
<repository> The (possibly remote) repository to clone from
<directory> The name of a new directory to clone into
optional arguments:
-h, --help show this help message and exit
--template <template_directory>
Specify the directory from which templates will be
used
--local, -l When the repository to clone from is on a local
machine, this flag bypasses the normal "Git aware"
transport mechanism and clones the repository by
making a copy of HEAD and everything under objects and
refs directories. The files under .git/objects/
directory are hardlinked to save space when possible.