more-argparse

Extra types and actions for argparse


Keywords
argparse, extension, package, python
License
AML
Install
pip install more-argparse==1.0.0.1

Documentation

Intro

Getting Started

Installing

First install with:

$ python3 -m pip install more-argparse

Importing

Then you import it with either:

import argparse
import margparse

or

from argparse import *
from margparse import *

It's important that you do the same for both.

Checking the Contents of margparse

First, open a Python interactive session:

$ python3

Then, import it and check the contents:

>>> import margparse
>>> dir(margparse)
['GlobbingType', '__all__', '__author__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', '_actions_all', '_types_all', 'actions', 'types']

Contents

Types

GlobbingType

If the argument is a glob, glob the argument and add each filename to a list as basetype(filename), otherwise return [basetype(argument)]

Arguments

Name Type Description
basetype callable see above; use case: basetype=argparse.FileType('r')
recursive bool passed to glob.glob