Skip to content

Commit e03ac5b

Browse files
committed
#317 Improve documentation for help
* Add the default mapping.config location in the help text * Prompt users to use `--mapping` or `--mappig-file` if the requreid field is not present Signed-off-by: Chin Yeung Li <[email protected]>
1 parent 179663d commit e03ac5b

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/attributecode/cmd.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def cli():
113113
help='Set OUTPUT inventory file format.')
114114

115115
@click.option('--mapping', is_flag=True,
116-
help='Use file mapping.config to collect the defined not supported fields in ABOUT files.')
116+
help='Use the default file mapping.config (./attributecode/mapping.config) with mapping between input keys and ABOUT field names.')
117117

118118
@click.option('--mapping-file', metavar='FILE', nargs=1,
119119
type=click.Path(exists=True, dir_okay=True, readable=True, resolve_path=True),
@@ -197,7 +197,7 @@ def inventory(location, output, mapping, mapping_file, quiet, format, show_all):
197197
help="Copy the 'license_file' from the directory to the generated location.")
198198

199199
@click.option('--mapping', is_flag=True,
200-
help='Use the default file mapping.config with mapping between input keys and ABOUT field names.')
200+
help='Use the default file mapping.config (./attributecode/mapping.config) with mapping between input keys and ABOUT field names.')
201201

202202
@click.option('--mapping-file', metavar='FILE', nargs=1,
203203
type=click.Path(exists=True, dir_okay=True, readable=True, resolve_path=True),
@@ -271,8 +271,7 @@ def gen(location, output, mapping, mapping_file, license_notice_text_location, f
271271
)
272272

273273
@click.option('--mapping', is_flag=True,
274-
help='Use the file "mapping.config" with mappings between the CSV '
275-
'inventory columns names and .ABOUT field names.')
274+
help='Use the default file mapping.config (./attributecode/mapping.config) with mapping between input keys and ABOUT field names.')
276275

277276
@click.option('--mapping-file', metavar='FILE', nargs=1,
278277
type=click.Path(exists=True, dir_okay=True, readable=True, resolve_path=True),

src/attributecode/gen.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,12 @@ def load_inventory(location, base_dir, license_notice_text_location=None,
135135
errors.extend(dup_about_paths_err)
136136
return errors, abouts
137137
except:
138-
msg = "The essential field 'about_file_path' is not found."
138+
msg = (
139+
"The essential field 'about_file_path' is not found.\n"
140+
"Use the --mapping or --mapping-file option to map the "
141+
"input keys and verify the mapping information are correct.\n"
142+
"OR correct the column names in the <input>"
143+
)
139144
errors.append(Error(CRITICAL, msg))
140145
return errors, abouts
141146

@@ -147,8 +152,8 @@ def load_inventory(location, base_dir, license_notice_text_location=None,
147152
if f not in fields:
148153
msg = (
149154
"Required column: %(f)r not found.\n"
150-
"Use the --mapping option to map the input keys and verify the "
151-
"mapping information are correct.\n"
155+
"Use the --mapping or --mapping-file option to map the "
156+
"input keys and verify the mapping information are correct.\n"
152157
"OR correct the column names in the <input>"
153158
) % locals()
154159

0 commit comments

Comments
 (0)