Commit 05a679b8 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

ENH: --column option now accepts a file containing a list of column names

parent ff027057
......@@ -11,6 +11,7 @@ arguments and configuration files.
import os.path as op
import functools as ft
import itertools as it
import multiprocessing as mp
import sys
import glob
......@@ -265,9 +266,10 @@ CLI_ARGUMENT_HELP = {
'--remove_unknown.',
'column' :
'Name of column to import. Can also be a glob-style wildcard pattern - '
'columns with a name matching the pattern will be imported. Can be used '
'multiple times. Implies --remove_unknown.',
'Name of column to import, or file containing a list of column names. Can '
'also be a glob-style wildcard pattern - columns with a name matching the '
'pattern will be imported. Can be used multiple times. Implies '
'--remove_unknown.',
'category' :
'Category ID or label to import. Can be used multiple times. Implies '
......@@ -699,6 +701,20 @@ def parseArgs(argv=None, namespace=None):
if args.variable is not None: args.variable = replaceIDs(args.variable)[0]
if args.exclude is not None: args.exclude = replaceIDs(args.exclude)[0]
# The column option accepts
# column names, or a file
# containing column names
def loadIfExists(path):
if op.exists(path):
with open(path, 'rt') as f:
items = f.readlines()
else:
items = [path]
return [i.strip() for i in items]
if args.column is not None:
args.column = list(it.chain(*[loadIfExists(c) for c in args.column]))
# visits are restricted using the
# keepVisits cleaning function
if args.visit is not None:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment