Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support passing -c/--config arg #235

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading