Skip to content

Commit

Permalink
Merge pull request #57 from fosslight/develop
Browse files Browse the repository at this point in the history
Add the -v option to print the installed version of FOSSLight Source Scanner
  • Loading branch information
soimkim authored Jan 4, 2022
2 parents ce39208 + ea58265 commit 12101e5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
scancode-toolkit
typecode_libmagic
XlsxWriter
fosslight_util>=1.3.4
fosslight_util>=1.3.8
PyYAML
wheel
8 changes: 7 additions & 1 deletion src/fosslight_source/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2021 LG Electronics Inc.
# SPDX-License-Identifier: Apache-2.0
from fosslight_util.help import PrintHelpMsg
from fosslight_util.help import PrintHelpMsg, print_package_version

_HELP_MESSAGE_SOURCE = """
Usage: fosslight_source [option1] <arg1> [option2] <arg2>...
Expand All @@ -19,6 +19,7 @@
Optional
-h\t\t\t\t Print help message
-v\t\t\t\t Print FOSSLight Source Scanner version
-j\t\t\t\t Generate raw result of scanners in json format
-m\t\t\t\t Print the Matched text for each license on a separate sheet (Scancode Only)
-o <output_path>\t\t Output path
Expand All @@ -37,12 +38,17 @@
Optional
-h\t\t\t\t Print help message
-v\t\t\t\t Print FOSSLight Source Scanner version
-m\t\t\t\t Print the Matched text for each license on a separate sheet
-o <output_path>\t\t Output path
\t\t\t\t (If you want to generate the specific file name, add the output path with file name.)
-f <format>\t\t\t Output file format (excel, csv, opossum)"""


def print_version(pkg_name):
print_package_version(pkg_name, "FOSSLight Source Scanner Version")


def print_help_msg_source():
helpMsg = PrintHelpMsg(_HELP_MESSAGE_SOURCE)
helpMsg.print_help_msg(True)
Expand Down
6 changes: 4 additions & 2 deletions src/fosslight_source/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import fosslight_util.constant as constant
from fosslight_util.set_log import init_log
from fosslight_util.timer_thread import TimerThread
from ._help import print_help_msg_source
from ._help import print_help_msg_source, print_version
from ._license_matched import get_license_list_to_print
from fosslight_util.output_format import check_output_format, write_output_file
from .run_scancode import run_scan
Expand Down Expand Up @@ -48,10 +48,12 @@ def main():
license_list = []

try:
opts, args = getopt.getopt(argv, 'hmjs:p:o:f:')
opts, args = getopt.getopt(argv, 'hvmjs:p:o:f:')
for opt, arg in opts:
if opt == "-h":
print_help_msg_source()
elif opt == "-v":
print_version(_PKG_NAME)
elif opt == "-p":
path_to_scan = arg
elif opt == "-j":
Expand Down
6 changes: 4 additions & 2 deletions src/fosslight_source/convert_scancode.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import yaml
from ._parsing_scancode_file_item import parsing_file_item, get_error_from_header
from fosslight_util.output_format import check_output_format, write_output_file
from ._help import print_help_msg_convert
from ._help import print_help_msg_convert, print_version
from ._license_matched import get_license_list_to_print

logger = logging.getLogger(constant.LOGGER_NAME)
Expand Down Expand Up @@ -133,10 +133,12 @@ def main():
format = ""

try:
opts, args = getopt.getopt(argv, 'hmp:o:f:')
opts, args = getopt.getopt(argv, 'hvmp:o:f:')
for opt, arg in opts:
if opt == "-h":
print_help_msg_convert()
elif opt == "-v":
print_version(_PKG_NAME)
elif opt == "-p":
path_to_find_json = arg
elif opt == "-o":
Expand Down

0 comments on commit 12101e5

Please sign in to comment.