6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/oddb2xml/options.rb', line 6
def self.parse(args = ARGV)
if args.is_a?(String)
args = args.split(" ")
end
@opts = Optimist.options(args) do
version "#{$0} ver.#{Oddb2xml::VERSION}"
banner " \#{File.expand_path($0)} version \#{Oddb2xml::VERSION}\n Usage:\n oddb2xml [option]\n produced files are found under data\n EOS\n opt :append, \"Additional target nonpharma\", default: false\n opt :artikelstamm, \"Create Artikelstamm Version 3 and 5 for Elexis >= 3.1\"\n opt :compress_ext, \"format F. {tar.gz|zip}\", type: :string, default: nil, short: \"c\"\n opt :extended, \"pharma, non-pharma plus prices and non-pharma from zurrose.\n Products without EAN-Code will also be listed.\n File oddb_calc.xml will also be generated\"\n opt :format, \"File format F, default is xml. {xml|dat}\n If F is given, -o option is ignored.\", type: :string, default: \"xml\"\n opt :include, \"Include target option for ean14 for 'dat' format.\n 'xml' format includes always ean14 records.\", short: \"i\"\n opt :increment, \"Increment price by x percent. Forces -f dat -p zurrose.\n create additional field price_resellerpub as\n price_extfactory incremented by x percent (rounded to the next 0.05 francs)\n in oddb_article.xml. In generated zurrose_transfer.dat PRPU is set to this price\n Forces -f dat -p zurrose.\", type: :int, default: nil, short: \"I\"\n opt :fi, \"Optional fachinfo output.\", short: \"o\"\n opt :price, \"Price source (transfer.dat) from ZurRose\", default: nil\n opt :tag_suffix, \"XML tag suffix S. Default is none. [A-z0-9]\n If S is given, it is also used as prefix of filename.\", type: :string, short: \"t\"\n opt :context, \"{product|address}. product is default.\", default: \"product\", type: :string, short: \"x\"\n opt :calc, \"create only oddb_calc.xml with GTIN, name and galenic information\"\n\n opt :skip_download, \"skips downloading files it the file is already under downloads.\n Downloaded files are saved under downloads\"\n opt :log, \"log important actions\", short: :none\n opt :use_ra11zip, \"Use the ra11.zip (a zipped transfer.dat from Galexis)\",\n default: File.exist?(\"ra11.zip\") ? \"ra11.zip\" : nil, type: :string\n opt :firstbase, \"Build all NONPHARMA articles on firstbase\", short: \"b\", default: false\n end\n\n @opts[:percent] = @opts[:increment]\n if @opts[:increment]\n @opts[:nonpharma] = true\n @opts[:price] = :zurrose\n end\n @opts[:ean14] = @opts[:increment]\n @opts.delete(:increment)\n @opts[:nonpharma] = @opts[:append]\n @opts.delete(:append)\n if @opts[:firstbase]\n @opts[:nonpharma] = true\n # https://github.com/zdavatz/oddb2xml/issues/76\n @opts[:calc] = true\n end\n if @opts[:extended]\n @opts[:nonpharma] = true\n @opts[:price] = :zurrose\n @opts[:calc] = true\n end\n if @opts[:artikelstamm]\n @opts[:extended] = true\n @opts[:price] = :zurrose\n end\n @opts[:price] = :zurrose if @opts[:price].is_a?(TrueClass)\n @opts[:price] = @opts[:price].to_sym if @opts[:price]\n @opts[:ean14] = @opts[:include]\n @opts[:format] = @opts[:format].to_sym if @opts[:format]\n @opts.delete(:include)\n @opts.delete(:help)\n @opts.delete(:version)\n\n @opts[:address] = false\n @opts[:address] = true if /^addr(ess)*$/i.match?(@opts[:context])\n @opts.delete(:context)\n\n @opts.delete(:price) unless @opts[:price]\n\n @opts.each { |k, v| @opts.delete(k) if /_given$/.match?(k.to_s) }\nend\n"
|