Skip to content

Commit

Permalink
--opt now accepts comma-separated options, e.g. --opt=systems,stations
Browse files Browse the repository at this point in the history
  • Loading branch information
kfsone committed Mar 11, 2015
1 parent 2461b71 commit 7a7bd17
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014

v6.13.2 Mar 10 2015
. (Tromador) Added "Painite" to Item.csv
. (kfsone) import plugin now allows you to separate --opt values with ,
e.g. trade.py import --plug=maddavo --opt=csvs,csvonly
will import mad's csv files without importing his prices

v6.13.1 Mar 06 2015
. (kfsone) "shipvendor" command:
Expand All @@ -23,6 +26,9 @@ v6.13.0 Mar 03 2015
- Added "--opt=csvonly" to stop after importing any csv files (no prices),
- Added "--opt=csvs" to import all the csvs
(equivalent to typing --opt=systems --opt=stations --opt=shipvendor)
e.g.
trade.py import --plug=maddavo --opt=csvs --opt=csvonly
trade.py import --plug=maddavo --opt=stations
. (kfsone) "market" sub-command:
- Default behavior is equivalent to "--buy --sell",
- You now only need to specify --buy (-B) or --sell (-S) to list ONLY
Expand Down
5 changes: 5 additions & 0 deletions commands/import_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from commands.exceptions import *
from commands.parsing import MutuallyExclusiveGroup, ParseArgument
from itertools import chain
from pathlib import Path

import cache
Expand Down Expand Up @@ -87,6 +88,10 @@
def run(results, cmdenv, tdb):
# If we're using a plugin, initialize that first.
if cmdenv.plug:
if cmdenv.pluginOptions:
cmdenv.pluginOptions = chain.from_iterable(
opt.split(',') for opt in cmdenv.pluginOptions
)
try:
pluginClass = plugins.load(cmdenv.plug, "ImportPlugin")
except plugins.PluginException as e:
Expand Down
3 changes: 3 additions & 0 deletions plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ def usage(self):
for opt in sorted(options.keys()):
text += "--opt={:<12} ".format(opt)
text += tw.fill(options[opt].strip()) + "\n"
text += "\n"
text += "You can also chain options together, e.g.:\n"
text += " --opt=systems,stations,csvonly\n"

return text

Expand Down

0 comments on commit 7a7bd17

Please sign in to comment.