Skip to content

Instantly share code, notes, and snippets.

View unpluggedcoder's full-sized avatar

UnpluggedCoder unpluggedcoder

View GitHub Profile
@unpluggedcoder
unpluggedcoder / cool_argparse_stuff.py
Created November 2, 2018 13:17 — forked from brantfaircloth/cool_argparse_stuff.py
Some cool argparse stuff
class FullPaths(argparse.Action):
"""Expand user- and relative-paths"""
def __call__(self, parser, namespace, values, option_string=None):
setattr(namespace, self.dest, os.path.abspath(os.path.expanduser(values)))
def is_dir(dirname):
"""Checks if a path is an actual directory"""
if not os.path.isdir(dirname):
msg = "{0} is not a directory".format(dirname)
raise argparse.ArgumentTypeError(msg)
__version__ = "0.1.6.8"
if __name__ == "__main__":
import sys
import argparse
def increment_line(args):
vi = [int(i) for i in __version__.split('.')]
print('current version: %s' % __version__)