cmd/ofx: Add option to use carriage returns for requests

This commit is contained in:
Aaron Lindsay 2020-11-17 09:20:27 -05:00
parent 10edd94920
commit 6807c93e0e
2 changed files with 7 additions and 4 deletions

View File

@ -22,6 +22,7 @@ func (c *command) usage() {
// flags common to all server transactions // flags common to all server transactions
var serverURL, username, password, org, fid, appID, appVer, ofxVersion, clientUID string var serverURL, username, password, org, fid, appID, appVer, ofxVersion, clientUID string
var noIndentRequests bool var noIndentRequests bool
var carriageReturn bool
func defineServerFlags(f *flag.FlagSet) { func defineServerFlags(f *flag.FlagSet) {
f.StringVar(&serverURL, "url", "", "Financial institution's OFX Server URL (see ofxhome.com if you don't know it)") f.StringVar(&serverURL, "url", "", "Financial institution's OFX Server URL (see ofxhome.com if you don't know it)")
@ -34,6 +35,7 @@ func defineServerFlags(f *flag.FlagSet) {
f.StringVar(&ofxVersion, "ofxversion", "203", "OFX version to use") f.StringVar(&ofxVersion, "ofxversion", "203", "OFX version to use")
f.StringVar(&clientUID, "clientuid", "", "Client UID (only required by a few FIs, like Chase)") f.StringVar(&clientUID, "clientuid", "", "Client UID (only required by a few FIs, like Chase)")
f.BoolVar(&noIndentRequests, "noindent", false, "Don't indent OFX requests") f.BoolVar(&noIndentRequests, "noindent", false, "Don't indent OFX requests")
f.BoolVar(&carriageReturn, "carriagereturn", false, "Use carriage return as line separator")
} }
func checkServerFlags() bool { func checkServerFlags() bool {

View File

@ -14,10 +14,11 @@ func newRequest() (ofxgo.Client, *ofxgo.Request) {
} }
var client = ofxgo.GetClient(serverURL, var client = ofxgo.GetClient(serverURL,
&ofxgo.BasicClient{ &ofxgo.BasicClient{
AppID: appID, AppID: appID,
AppVer: appVer, AppVer: appVer,
SpecVersion: ver, SpecVersion: ver,
NoIndent: noIndentRequests, NoIndent: noIndentRequests,
CarriageReturn: carriageReturn,
}) })
var query ofxgo.Request var query ofxgo.Request