Skip to content

Commit

Permalink
Merge pull request #235 from rkok/feature/config-arg
Browse files Browse the repository at this point in the history
Support passing -c/--config arg
  • Loading branch information
kedder authored Aug 7, 2023
2 parents 9f38a90 + 4791986 commit 62675fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ To convert the proprietary CSV file ``danske.csv`` into the OFX file ``danske.of
Note that configuration parameters are plugin specific. See the plugin
documentation for more info.

To use a custom configuration file, pass the ``-c`` / ``--config`` option::

$ ofxstatement convert -t pluginname -c /path/to/myconfig.ini input.csv output.ofx

Writing your own Plugin
=======================

Expand Down
9 changes: 8 additions & 1 deletion src/ofxstatement/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ def make_args_parser() -> argparse.ArgumentParser:
# convert
parser_convert = subparsers.add_parser("convert", help="convert to OFX")

parser_convert.add_argument(
"-c",
"--config",
metavar="myconfig.ini",
default=None,
help="custom config file to use",
)
parser_convert.add_argument(
"-t",
"--type",
Expand Down Expand Up @@ -145,7 +152,7 @@ def edit_config(args: argparse.Namespace) -> None:

def convert(args: argparse.Namespace) -> int:
appui = ui.UI()
config = configuration.read()
config = configuration.read(args.config)

if config is None:
# No configuration mode
Expand Down

0 comments on commit 62675fd

Please sign in to comment.