Skip to content

Commit 0db7bab

Browse files
committed
Add documentation for new --dir CLI option
Signed-off-by: Kevin Ji <kyji1011@gmail.com>
1 parent ebd3097 commit 0db7bab

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

docs/source/cli-reference/basic-options.rst

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,61 @@
99

1010
----
1111

12+
``-dir, --additional_directories`` Options
13+
----------------------------------
14+
15+
.. admonition:: Dependency
16+
17+
The option ``-dir, --additional_directories`` is a sub-option of and requires the option
18+
``--license``.
19+
20+
The ``-dir, --additional_directories`` option allows the user to include additional directories
21+
of licenses to use in license detection.
22+
23+
This command only needs to be run once for each set of additional directories; in all subsequent
24+
runs of Scancode with the same directories all the licenses in the directories will be cached.
25+
26+
The directory structure should look something like this::
27+
28+
licenses/
29+
├── privateLicense1/
30+
│ ├── license/
31+
│ │ ├── privateLicense1.LICENSE
32+
│ │ └── privateLicense1.yml
33+
│ └── rule/
34+
│ ├── privateLicense1.RULE
35+
│ └── privateLicense1.yml
36+
└── privateLicense2/
37+
├── license/
38+
│ ├── privateLicense2.LICENSE
39+
│ └── privateLicense2.yml
40+
└── rule/
41+
├── privateLicense2.RULE
42+
└── privateLicense2.yml
43+
44+
A scan example using the ``-dir, --additional_directories PATH`` option with a single directory::
45+
46+
scancode -clpieu --json-pp output.json samples -dir /home/user/external_licenses/license1
47+
48+
You can also include multiple directories like so::
49+
50+
scancode -clpieu --json-pp output.json samples -dir /home/user/external_licenses/external1 -dir /home/user/external_licenses/external2
51+
52+
If you want to continue running scans with ``/home/user/external_licenses/external1`` and ``/home/user/external_licenses/external2``,
53+
you can omit the ``-dir`` option in subsequent scans and they will still be included. ::
54+
55+
scancode -clpieu --json-pp output.json samples
56+
57+
However, if you wanted to run a scan with a new set of directories, such as ``home/user/external_licenses/external1``
58+
and ``home/user/external_licenses/external3``, you would need to rerun the scan with those directories as parameters. ::
59+
60+
scancode -clpieu --json-pp output.json samples -dir /home/user/external_licenses/external1 -dir /home/user/external_licenses/external3
61+
62+
63+
..
64+
65+
----
66+
1267
``--generated`` Options
1368
-----------------------
1469

docs/source/rst_snippets/basic_options.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ documenting a program's options. For example:
5555

5656
.. include:: /rst_snippets/note_snippets/basic_clpieu.rst
5757

58+
-dir, --additional_directories PATH
59+
60+
Include paths to directories containing additional licenses and rules to use
61+
in license detection. This can be used multiple times for multiple directories.
62+
63+
Sub-Option of - ``--license``
64+
5865
--generated Classify automatically generated code files with a flag.
5966

6067
--max-email INT Report only up to INT emails found in a

0 commit comments

Comments
 (0)