The unified diff between revisions [fddd6171..] and [46260d8c..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "ChartInterface.py"
# from [e5685f92f0ad4135d353c660b623463fc3be8feb]
# to [8b34bec4b90d744f0fc326d8bbc79b0c6b6feeb2]
#
# patch "SystemInterface.py"
# from [7459c5ffc1e0a29017c91b5f37c1bfd63a05d496]
# to [1e554f35a84a6a7347f7e4922e9cdf58a49b0545]
#
============================================================
--- ChartInterface.py e5685f92f0ad4135d353c660b623463fc3be8feb
+++ ChartInterface.py 8b34bec4b90d744f0fc326d8bbc79b0c6b6feeb2
@@ -5,6 +5,7 @@ import sys
# Utilities associated with command line UI
import sys
+import shlex
from CLIParser import CLIParser, CLIParserError
from States import *
@@ -75,10 +76,33 @@ class ChartInterface:
vstatus.change_state(STATE_CHART_IDLE, 1)
def create(self, state, event, params, v, vstatus):
- args = self.input.split()
- print "filename is %s" % (args[1],)
+ args = shlex.split(self.input)
+ print args
+ # FIXME need to check the robustness and presences of values
+ op = CLIParser(usage = "foo")
+ op.add_option("-d", "--details", dest="details", type="string",
+ help="Ledger Details")
+ op.add_option("-D", "--debit-balance", action="store_true",
+ dest="debitbalance",
+ help="Debit Balance")
+ op.add_option("-C", "--credit-balance", action="store_false",
+ dest="debitbalance",
+ help="Credit Balance")
+ op.add_option("-i", "--info", dest="info", type="string",
+ help="Ledger Info Field")
+ try:
+ options, args = op.parse_args(args)
+ print args
+ print options
+ except CLIParserError:
+ print "command problem: %s" % (self.input,)
+# return
+
+# if len(args) != 0:
+# op.error('extra command line arguments: ' + ' '.join(args))
+
vstatus.change_state(STATE_CHART_IDLE, 1)
def details(self, state, event, params, v, vstatus):
============================================================
--- SystemInterface.py 7459c5ffc1e0a29017c91b5f37c1bfd63a05d496
+++ SystemInterface.py 1e554f35a84a6a7347f7e4922e9cdf58a49b0545
@@ -52,15 +52,18 @@ class SystemInterface:
if len(args) >= 1 and args[0] == "status":
vstatus.change_state(STATE_STATUS, 1)
return
-
+
+ # FIXME restrict this mode if db not created/connected
if len(args) >= 1 and args[0] == "chart":
vstatus.change_state(STATE_CHART_IDLE, 1)
return
+ # FIXME restrict this mode if db not created/connected
if len(args) >= 1 and args[0] == "ledger":
vstatus.change_state(STATE_LEDGER_IDLE, 1)
return
+ # FIXME restrict this mode if db not created/connected
if len(args) >= 1 and args[0] == "journal":
vstatus.change_state(STATE_JOURNAL_IDLE, 1)
return