forked from gaugendre/ofx-processor
Update docs and reorder commands
This commit is contained in:
parent
eef563ac7c
commit
bbc60b0e01
7 changed files with 27 additions and 12 deletions
11
README.md
11
README.md
|
@ -21,15 +21,18 @@
|
|||
```shell script
|
||||
Usage: ynab [OPTIONS] COMMAND [ARGS]...
|
||||
|
||||
Import your data to YNAB with the processors listed below or manage your
|
||||
config.
|
||||
|
||||
Options:
|
||||
--version Show the version and exit.
|
||||
-h, --help Show this message and exit.
|
||||
|
||||
Commands:
|
||||
bpvf Process BPVF bank statement (OFX)
|
||||
ce Process CE bank statement (OFX)
|
||||
config
|
||||
revolut Process Revolut bank statement (CSV)
|
||||
config Manage configuration.
|
||||
bpvf Import BPVF bank statement (OFX file).
|
||||
ce Import CE bank statement (OFX file).
|
||||
revolut Import Revolut bank statement (CSV file).
|
||||
```
|
||||
|
||||
All transactions will be pushed to YNAB. If this is your first time using the script,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import click
|
||||
|
||||
from ofx_processor.utils import ynab
|
||||
from ofx_processor.utils.utils import discover_processors
|
||||
from ofx_processor.utils.utils import discover_processors, OrderedGroup
|
||||
|
||||
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
|
||||
|
||||
|
||||
@click.group(context_settings=CONTEXT_SETTINGS)
|
||||
@click.group(context_settings=CONTEXT_SETTINGS, cls=OrderedGroup)
|
||||
@click.version_option()
|
||||
def cli():
|
||||
"""
|
||||
|
|
|
@ -57,7 +57,8 @@ class BpvfProcessor(Processor):
|
|||
return ofx.statements[0].transactions
|
||||
|
||||
@staticmethod
|
||||
@click.command("bpvf", help="Process BPVF bank statement (OFX)")
|
||||
@click.command("bpvf")
|
||||
@click.argument("ofx_filename")
|
||||
def main(ofx_filename):
|
||||
"""Import BPVF bank statement (OFX file)."""
|
||||
BpvfProcessor(ofx_filename).push_to_ynab()
|
||||
|
|
|
@ -25,7 +25,8 @@ class CeProcessor(BpvfProcessor):
|
|||
line_class = CeLine
|
||||
|
||||
@staticmethod
|
||||
@click.command("ce", help="Process CE bank statement (OFX)")
|
||||
@click.command("ce")
|
||||
@click.argument("ofx_filename")
|
||||
def main(ofx_filename):
|
||||
"""Import CE bank statement (OFX file)."""
|
||||
CeProcessor(ofx_filename).push_to_ynab()
|
||||
|
|
|
@ -62,7 +62,8 @@ class RevolutProcessor(Processor):
|
|||
sys.exit(1)
|
||||
|
||||
@staticmethod
|
||||
@click.command("revolut", help="Process Revolut bank statement (CSV)")
|
||||
@click.command("revolut")
|
||||
@click.argument("csv_filename")
|
||||
def main(csv_filename):
|
||||
"""Import Revolut bank statement (CSV file)."""
|
||||
RevolutProcessor(csv_filename).push_to_ynab()
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import collections
|
||||
import importlib
|
||||
import pkgutil
|
||||
|
||||
|
@ -25,3 +26,13 @@ def discover_processors(cli: click.Group):
|
|||
if item.endswith("Processor") and item != "Processor":
|
||||
cls = getattr(module, item)
|
||||
cli.add_command(cls.main)
|
||||
|
||||
|
||||
class OrderedGroup(click.Group):
|
||||
def __init__(self, name=None, commands=None, **attrs):
|
||||
super(OrderedGroup, self).__init__(name, commands, **attrs)
|
||||
#: the registered subcommands by their exported names.
|
||||
self.commands = commands or collections.OrderedDict()
|
||||
|
||||
def list_commands(self, ctx):
|
||||
return self.commands
|
||||
|
|
|
@ -30,9 +30,7 @@ def get_config_file_name():
|
|||
|
||||
@click.group()
|
||||
def config():
|
||||
"""
|
||||
Manage configuration with subcommands
|
||||
"""
|
||||
"""Manage configuration."""
|
||||
|
||||
|
||||
@config.command("edit")
|
||||
|
|
Loading…
Reference in a new issue