Skip to content

Instantly share code, notes, and snippets.

@DamnedFacts
DamnedFacts / argumentor.py
Last active February 4, 2021 19:38 — forked from Ed-von-Schleck/gist:6391140
Generating a Command Line Interface from Function Definitions. Source link: https://tech.pro/tutorial/1548/generating-a-command-line-interface-from-function-definitions
import sys
if sys.version_info.major != 3 or sys.version_info.minor < 3:
print("This module requires Python version 3.3 or later")
sys.exit(1)
import argparse
import inspect
class Argumentor:
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.