mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-05 02:46:10 +02:00
Improve the CLI situation a bit.
Fix bugs related to parsing the new COPY type, and make it so that we know how to parse options (and fields, and other type dependant things) even when --type is missing, in care the source URL has the information.
This commit is contained in:
parent
e1bc6425e2
commit
a86369a03d
@ -286,6 +286,7 @@
|
||||
(source (if type
|
||||
(parse-source-string-for-type type source)
|
||||
(parse-source-string source)))
|
||||
(type (parse-cli-type (conn-type source)))
|
||||
(target (parse-target-string (second arguments))))
|
||||
|
||||
;; some verbosity about the parsing "magic"
|
||||
|
||||
@ -476,6 +476,7 @@
|
||||
|
||||
;; connection types / classes symbols for use in main
|
||||
#:connection
|
||||
#:conn-type
|
||||
#:csv-connection
|
||||
#:fixed-connection
|
||||
#:copy-connection
|
||||
|
||||
@ -258,6 +258,7 @@
|
||||
|
||||
(defrule cli-type (or "csv"
|
||||
"fixed"
|
||||
"copy"
|
||||
dbf-type-name
|
||||
"ixf"
|
||||
"sqlite"
|
||||
@ -281,16 +282,18 @@
|
||||
(loop :for field :in fields
|
||||
:append (parse (case type
|
||||
(:csv 'csv-source-fields)
|
||||
(:fixed 'fixed-source-fields))
|
||||
(:fixed 'fixed-source-fields)
|
||||
(:copy 'copy-source-fields))
|
||||
field)))
|
||||
|
||||
(defun parse-cli-options (type options)
|
||||
"Parse options as per the WITH clause when we get them from the CLI."
|
||||
(alexandria:alist-plist
|
||||
(loop :for option :in options
|
||||
:collect (parse (case type
|
||||
:collect (parse (ecase type
|
||||
(:csv 'csv-option)
|
||||
(:fixed 'fixed-option)
|
||||
(:copy 'copy-option)
|
||||
(:dbf 'dbf-option)
|
||||
(:ixf 'ixf-option)
|
||||
(:sqlite 'sqlite-option)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user