Skip to content

Commit ba4e01f

Browse files
committed
Merge branch 'develop' of https://github.com/dejacode/about-code-tool.git into develop
2 parents ff053ff + 6d115b2 commit ba4e01f

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

USAGE.rst

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,27 +136,36 @@ Options
136136
--mapping
137137

138138
This tool needs the input CSV to have the required and/or optional keys to work.
139-
By understanding the user's input may not have the same keys name as the tool use,
140-
there are two ways the users can do.
141-
1. Change the keys name directly in the input manually.
142-
2. Use the '--mapping' option to configure the keys mapping.
143-
144-
When the '--mapping' is set, this tool will look into the 'MAPPING.CONFIG'
145-
and do the keys mapping.
146-
147-
For instance, assuming the context of the MAPPING.CONFIG is the following:
139+
Since the user input may not have the same column key names used by the tool,
140+
there are two ways to reconcile that:
141+
1. Change the key names directly in the input manually to match the field names
142+
supported by the AboutCode specification.
143+
Note: genabout.py looks for an about_file field and uses it to derive the mandatory
144+
output field about_resource.
145+
2. Use the '--mapping' option to configure the key mapping. This method provides the
146+
most flexiblity and control.
147+
When the '--mapping' option is set, the tool will look into the 'MAPPING.CONFIG'
148+
file to determine key mapping.
149+
150+
The format of each text line in the MAPPING.CONFIG file is as follows:
151+
{{about_file_target_field_name}}: {{input_csv_file_field_name}}
152+
153+
For instance, assume that MAPPING.CONFIG contains the following:
148154
about_resource: file_name
149155
about_file: Resource
150156
name: Component
151157
version: file_version
152158

153-
This tool will look into the input CSV and try to find the column key named
154-
'file_name' and configure to map with the 'about_resource' key that this
155-
tool use. The 'Resource' will then configure to map with 'about_file' and
159+
The tool will look into the input CSV and try to find the column key named
160+
'file_name' and configure to map with the 'about_resource' key that the
161+
tool uses. The 'Resource' will then configure to map with 'about_file' and
156162
so on.
157163

158-
In another word, users do not need to modify the keys name of the
159-
input manually but let the 'MAPPING.CONFIG' to do the keys mapping.
164+
In another word, you do not need to modify the key names of the
165+
input manually, but rather use the MAPPING.CONFIG to do the key mapping.
166+
167+
Another advantage of using the MAPPING.CONFIG is the ability to specify
168+
any field names that are important to you, including custom fields.
160169

161170
$ python genabout.py --mapping <input path> <output path>
162171

0 commit comments

Comments
 (0)