8282from scancode .utils import BaseCommand
8383from scancode .utils import path_progress_message
8484from scancode .utils import progressmanager
85+ from scancode .help import examples_text
86+ from scancode .help import epilog_text
8587
8688# Python 2 and 3 support
8789try :
@@ -116,76 +118,6 @@ def logger_debug(*args):
116118
117119echo_stderr = partial (click .secho , err = True )
118120
119- # FIXME: this should be pushed out in some external help or pushed down in plugins.
120- # FIXME: the glob story is very weird!!!
121- examples_text = '''
122- Scancode command lines examples:
123-
124- (Note for Windows: use '\\ ' back slash instead of '/' forward slash for paths.)
125-
126- Scan a single file for copyrights. Print scan results to stdout as JSON:
127-
128- scancode --copyright samples/zlib/zlib.h --json
129-
130- Scan a single file for licenses, print verbose progress to stderr as each
131- file is scanned. Save scan to a JSON file:
132-
133- scancode --license --verbose samples/zlib/zlib.h --json licenses.json
134-
135- Scan a directory explicitly for licenses and copyrights. Redirect JSON scan
136- results to a file:
137-
138- scancode --json -l -c samples/zlib/ > scan.json
139-
140- Scan a directory while ignoring a single file.
141- Print scan results to stdout as JSON:
142-
143- scancode --json --ignore README samples/
144-
145- Scan a directory while ignoring all files with .txt extension.
146- Print scan results to stdout as JSON.
147- It is recommended to use quotes around glob patterns to prevent pattern
148- expansion by the shell:
149-
150- scancode --json --ignore "*.txt" samples/
151-
152- Special characters supported in GLOB pattern:
153- - * matches everything
154- - ? matches any single character
155- - [seq] matches any character in seq
156- - [!seq] matches any character not in seq
157-
158- For a literal match, wrap the meta-characters in brackets.
159- For example, '[?]' matches the character '?'.
160- For details on GLOB patterns see https://en.wikipedia.org/wiki/Glob_(programming).
161-
162- Note: Glob patterns cannot be applied to path as strings.
163- For example, this will not ignore "samples/JGroups/licenses".
164-
165- scancode --json --ignore "samples*licenses" samples/
166-
167-
168- Scan a directory while ignoring multiple files (or glob patterns).
169- Print the scan results to stdout as JSON:
170-
171- scancode --json --ignore README --ignore "*.txt" samples/
172-
173- Scan the 'samples' directory for licenses and copyrights. Save scan results to
174- an HTML app file for interactive scan results navigation. When the scan is done,
175- open 'scancode_result.html' in your web browser. Note that additional app files
176- are saved in a directory named 'scancode_result_files':
177-
178- scancode --output-html-app scancode_result.html samples/
179-
180- Scan a directory for licenses and copyrights. Save scan results to an
181- HTML file:
182-
183- scancode --output-html scancode_result.html samples/zlib
184-
185- To extract archives, see the 'extractcode' command instead.
186- '''
187-
188-
189121def print_examples (ctx , param , value ):
190122 if not value or ctx .resilient_parsing :
191123 return
@@ -200,27 +132,6 @@ def print_version(ctx, param, value):
200132 ctx .exit ()
201133
202134
203- # FIXME: this should be pushed out in some external help or pushed down in plugins.
204- epilog_text = '''Examples (use --examples for more):
205-
206- \b
207- Scan the 'samples' directory for licenses and copyrights.
208- Save scan results to the 'scancode_result.json' JSON file:
209-
210- scancode --license --copyright --json=scancode_result.json samples
211-
212- \b
213- Scan the 'samples' directory for licenses and package manifests. Print scan
214- results on screen as pretty-formatted JSON (using the special '-' FILE to print
215- to on screen/to stdout):
216-
217- scancode --json-pp - --license --package samples
218-
219- Note: when you run scancode, a progress bar is displayed with a counter of the
220- number of files processed. Use --verbose to display file-by-file progress.
221- '''
222-
223-
224135class ScanCommand (BaseCommand ):
225136 """
226137 A command class that is aware of ScanCode options that provides enhanced
0 commit comments