|
3 | 3 | # Copyright (c) 2021 LG Electronics Inc. |
4 | 4 | # SPDX-License-Identifier: Apache-2.0 |
5 | 5 | from fosslight_util.help import PrintHelpMsg, print_package_version |
6 | | -from fosslight_util.output_format import SUPPORT_FORMAT |
7 | | - |
8 | | -_HELP_MESSAGE_DEPENDENCY = f""" |
9 | | - Usage: fosslight_dependency [option1] <arg1> [option2] <arg2>... |
10 | | -
|
11 | | - FOSSLight Dependency Scanner is the tool that supports the analysis of dependencies for multiple package managers. |
12 | | - It detects the manifest file of package managers automatically and analyzes the dependencies with using open source tools. |
13 | | - Then, it generates the report file that contains OSS information of dependencies. |
14 | | -
|
15 | | - Currently, it supports the following package managers: |
16 | | - Gradle (Java) |
17 | | - Maven (Java) |
18 | | - NPM (Node.js) |
19 | | - PNPM (Node.js) |
20 | | - Yarn (Node.js) |
21 | | - PIP (Python) |
22 | | - Pub (Dart with flutter) |
23 | | - Cocoapods (Swift/Obj-C) |
24 | | - Swift (Swift) |
25 | | - Carthage (Swift/Obj-C) |
26 | | - Go (Go) |
27 | | - Nuget (.NET) |
28 | | - Helm (Kubernetes) |
29 | | - Unity (Unity) |
30 | | - Cargo (Rust) |
31 | | -
|
32 | | - Options: |
33 | | - Optional |
34 | | - -h\t\t\t\t Print help message. |
35 | | - -v\t\t\t\t Print the version of the script. |
36 | | - -m <package_manager>\t Enter the package manager. |
37 | | - \t(npm, maven, gradle, pypi, pub, cocoapods, android, swift, carthage, |
38 | | - \t go, nuget, helm, unity, cargo, pnpm, yarn) |
39 | | - -p <input_path>\t\t Enter the path where the script will be run. |
40 | | - -e <exclude_path>\t\t Enter the path where the analysis will not be performed (files and directories). |
41 | | - \t\t\t\t * IMPORTANT: Always wrap patterns in double quotes ("") to avoid shell expansion. |
42 | | - \t\t\t\t Example) fosslight_dependency -e "test/abc.py" "*.jar" |
43 | | - -o <output_path>\t\t Output path |
44 | | - \t\t\t\t\t(If you want to generate the specific file name, add the output path with file name.) |
45 | | - -f <format> [<format> ...]\t Output formats |
46 | | - \t\t\t\t \t({', '.join(SUPPORT_FORMAT)}) |
47 | | - \t\t\t\t Multiple formats can be specified separated by space. |
48 | | - --graph-path <save_path> \t Enter the path where the graph image will be saved |
49 | | - \t\t\t\t\t(ex. /your/directory/path/filename.[pdf, jpg, png]) (recommend pdf extension) |
50 | | - --graph-size <width> <height> Enter the size of the graph image (The size unit is pixels) |
51 | | - \t\t\t\t\t--graph-path option is required |
52 | | - --direct\t\t\t Print the direct/transitive dependency type in comment. |
53 | | - \t\tChoice 'True' or 'False'. (default:True) |
54 | | - -r\t\t\t\t Recursive mode. Scan all subdirectories for manifest files. |
55 | | - --notice\t\t\t Print the open source license notice text. |
56 | | -
|
57 | | - Required only for swift, carthage |
58 | | - -t <token>\t\t\t Enter the github personal access token. |
59 | | -
|
60 | | - Optional only for pypi |
61 | | - -a <activate_cmd>\t\t Virtual environment activate command(ex, 'conda activate (venv name)') |
62 | | - -d <deactivate_cmd>\t\t Virtual environment deactivate command(ex, 'conda deactivate') |
63 | | -
|
64 | | - Optional only for gradle, maven |
65 | | - -c <dir_name>\t\t Enter the customized build output directory name |
66 | | - \t\t-Default name : 'build' for gradle, 'target' for maven |
67 | | -
|
68 | | - Optional only for android |
69 | | - -n <app_name>\t\t Enter the application directory name where the plugin output file is located(default: app) |
70 | | - """ |
| 6 | + |
| 7 | +_HELP_MESSAGE_DEPENDENCY = """ |
| 8 | + π Usage |
| 9 | + ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| 10 | + fosslight_dependency [options] <arguments> |
| 11 | +
|
| 12 | + π Description |
| 13 | + ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| 14 | + FOSSLight Dependency Scanner analyzes dependencies for multiple package |
| 15 | + managers. It detects manifest files automatically and generates reports |
| 16 | + containing OSS information of dependencies. |
| 17 | +
|
| 18 | + π Guide: https://fosslight.org/fosslight-guide/scanner/3_dependency.html |
| 19 | +
|
| 20 | + π¦ Supported Package Managers |
| 21 | + ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| 22 | + Gradle, Maven (Java) β NPM, PNPM, Yarn (Node.js) |
| 23 | + PIP (Python) β Pub (Dart/Flutter) |
| 24 | + Cocoapods, Swift, Carthage β Go (Go) |
| 25 | + Nuget (.NET) β Helm (Kubernetes) |
| 26 | + Unity (Unity) β Cargo (Rust) |
| 27 | +
|
| 28 | + βοΈ General Options |
| 29 | + ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| 30 | + -p <path> Path to analyze (default: current directory) |
| 31 | + -o <path> Output file path or directory |
| 32 | + -f <format> Output formats: excel, csv, opossum, yaml, spdx-tag, spdx-yaml, spdx-json, spdx-xml |
| 33 | + (multiple formats can be specified, separated by space) |
| 34 | + -e <pattern> Exclude paths from analysis (files and directories) |
| 35 | + β οΈ IMPORTANT: Always wrap in quotes to avoid shell expansion |
| 36 | + Example: fosslight_dependency -e "test/" "node_modules/" |
| 37 | + -h Show this help message |
| 38 | + -v Show version information |
| 39 | +
|
| 40 | + π Scanner-Specific Options |
| 41 | + ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| 42 | + -m <manager> Specify package manager (npm, maven, gradle, pypi, pub, |
| 43 | + cocoapods, android, swift, carthage, go, nuget, helm, |
| 44 | + unity, cargo, pnpm, yarn) |
| 45 | + -r Recursive mode: scan all subdirectories for manifest files |
| 46 | + --graph-path <path> Save dependency graph image (pdf, jpg, png) (recommend pdf extension) |
| 47 | + Example: fosslight_dependency --graph-path /your/path/filename.[pdf, jpg, png] |
| 48 | + --graph-format <format> Set graph image format (default: pdf) |
| 49 | + --graph-size <w> <h> Set graph image size in pixels (requires --graph-path) |
| 50 | + --direct <True|False> Print direct/transitive dependency type |
| 51 | + Choose True or False (default: True) |
| 52 | + --notice Print the open source license notice text |
| 53 | +
|
| 54 | + π§ Package Manager Specific Options |
| 55 | + ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| 56 | + Swift, Carthage: |
| 57 | + -t <token> GitHub personal access token |
| 58 | +
|
| 59 | + Pypi: |
| 60 | + -a <cmd> Virtual environment activate command |
| 61 | + (ex: 'conda activate myenv') |
| 62 | + -d <cmd> Virtual environment deactivate command |
| 63 | + (ex: 'conda deactivate') |
| 64 | +
|
| 65 | + Gradle, Maven: |
| 66 | + -c <dir> Customized build output directory |
| 67 | + (default: 'build' for gradle, 'target' for maven) |
| 68 | +
|
| 69 | + Android: |
| 70 | + -n <name> Application directory name (default: app) |
| 71 | +
|
| 72 | + π‘ Examples |
| 73 | + ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| 74 | + # Scan current directory |
| 75 | + fosslight_dependency |
| 76 | +
|
| 77 | + # Scan specific path with exclusions |
| 78 | + fosslight_dependency -p /path/to/project -e "test/" "vendor/" |
| 79 | +
|
| 80 | + # Generate output in specific format |
| 81 | + fosslight_dependency -f excel -o results/ |
| 82 | +
|
| 83 | + # Specify package manager |
| 84 | + fosslight_dependency -m npm -p /path/to/nodejs/project |
| 85 | +
|
| 86 | + # Recursive scan with all subdirectories |
| 87 | + fosslight_dependency -r |
| 88 | +
|
| 89 | + # Generate dependency graph |
| 90 | + fosslight_dependency --graph-path dependency_tree.pdf |
| 91 | +""" |
71 | 92 |
|
72 | 93 |
|
73 | 94 | def print_version(pkg_name: str) -> None: |
|
0 commit comments