def test_adding_commands(): p = Parguments(__doc__) assert p._commands == {} @p.command def add(name): """ Usage: parguments add <name> """ assert name == "catsup" assert "add" in p._commands def remove(name): """ Usage: parguments remove <name> """ assert name == "wordpress" p.add_command(remove) assert "remove" in p._commands p.run(argv=["add", "catsup"], exit=False) p.run(command="add", argv=["remove", "catsup"], exit=False) import sys sys.argv[1:] = ["add", "catsup"] p.run(exit=False) try: p.run(argv=["remove", "wordpress"]) except SystemExit: pass else: raise
--recurse-submodules initialize submodules in the clone --template <template-directory> directory from which templates will be used --reference <repo> reference repository -o, --origin <branch> use <branch> instead of 'origin' to track upstream -b, --branch <branch> checkout <branch> instead of the remote's HEAD -u, --upload-pack <path> path to git-upload-pack on the remote --depth <depth> create a shallow clone of that depth """ print(args) git.add_command(clone) def print_args(args): print(args) git.add_command(name='checkout', func=print_args, doc=""" usage: git checkout [options] <branch> git checkout [options] <branch> -- <file>... -q, --quiet suppress progress reporting -b <branch> create and checkout a new branch -B <branch> create/reset and checkout a branch -l create reflog for new branch -t, --track set upstream info for new branch