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
|
# File 'lib/libis/metadata/cli/cli_downloader.rb', line 18
def self.included(klass)
klass.class_exec do
desc 'download [options] [TERM[:PID] ...]', 'Download metadata from Alma or Scope'
long_desc " \n 'download [TERM ...]' will download metadata from Alma or Scope and convert it to Dublin Core.\n \n The output format can either be Dublin Core or a Rosetta MD Update file. If you supply a Rosetta IE PID the \n tool will generate a Rosetta MD Update file, a Dublin Core XML file if you don't. Note that there is no \n check if the IE PID is a valid one.\n \n Any TERM argument that starts with a '@' will be interpreted as an input file name. The input file name can\n be:\n\n * a simple text file. File extension should be '.txt' and each non-empty line is interpreted as if it was\n supplied as a TERM argument on the command line.\n\n * a comma-delimited file (CSV). File extension should be '.csv'.\n\n * a tab-deliimited file (TSV). File extension should be '.tsv'.\n\n * a spreadsheet. Excel files (.xls or xlsx) and OpenOffice/LibreOffice Calc files (.ods) are supported.\n '@<sheet_name>' must be appended to the file name to select the proper sheet tab.\n\n For the CSV, TSV and spreadsheets: if there is no header row, the first column should contain the search \n terms. If present, the second column should contain PID info and the third column FILE info. Other columns \n are ignored. If there is a header row, it should contain at least a cell with the text 'Term'. That column \n is expexted to contain the search terms. If a column header with the text 'Pid' is found, the column data \n will be expected to contain pids for the IE's to modify. If a column header with the text 'File' is found, \n the column data will be expected to contain file names to save to.\n\n In any case, if the output file info is missing, the name defaults to the PID (if present) or the search \n term. If the FILE info does not have a file extension, '.xml' will be added. \n \n The list of TERM arguments will be processed automatically. If there are no terms supplied on the command \n line, the program will ask for them until you supply an empty value. A TERM argument can contain PID and \n FILE info separated by a ':' or whatever you supply for the separator option. TERM arguments supplied via \n a simple text file are interpreted the same way.\n\n Examples:\n * abc => searches for 'abc' and save DC metadata in abc.xml\n * abc:123 => searches for 'abc' and generates MD Update in 123.xml\n * abc:123:xyz.data => searches for 'abc' and generates MD Update in xyz.data\n * abc::xyz => searches for 'abc' and save DC metadata in xyz.xml\n\n For any option that is not supplied on the command line and doesn't have a default value, the tool will \n always ask you to supply a value, even if the '-q' option is given.\n\n DESC\n\n method_option :quiet, aliases: '-q', desc: 'Do not ask for options that have a default value',\n type: :boolean, default: false\n method_option :metadata, aliases: '-m', banner: 'source', desc: 'Metadata source system',\n default: VALID_SOURCES.keys.first, enum: VALID_SOURCES.keys\n method_option :field, aliases: '-f', banner: 'field_name', desc: 'Search field in the Metadata system;' +\n \" default value depends on selected metadata source system: \#{VALID_SOURCES}\"\n method_option :library, aliases: '-l', banner: 'library_code', desc: 'Library code for Alma',\n default: '32KUL_KUL'\n method_option :database, aliases: '-d', desc: 'Scope database to connect to'\n method_option :user, aliases: '-u', desc: 'Database user name'\n method_option :password, aliases: '-p', desc: 'Database password'\n method_option :target_dir, aliases: '-t', desc: 'Directory where files will be created', default: '.'\n method_option :separator, aliases: '-s', desc: 'Separator for the TERM arguments', default: ':'\n\n end\nend\n"
|