Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/scancode/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def print_examples(ctx, param, value):
def print_version(ctx, param, value):
if not value or ctx.resilient_parsing:
return
click.echo('ScanCode version ' + scancode_config.__version__)
click.echo('ScanCode Output Format version ' + scancode_config.__output_format_version__)
click.echo('SPDX License list version ' + scancode_config.spdx_license_list_version)
click.echo(f'ScanCode version: {scancode_config.__version__}')
click.echo(f'ScanCode Output Format version: {scancode_config.__output_format_version__}')
click.echo(f'SPDX License list version: {scancode_config.spdx_license_list_version}')
ctx.exit()


Expand Down
11 changes: 11 additions & 0 deletions tests/scancode/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,3 +929,14 @@ def test_VirtualCodebase_output_with_from_json_is_same_as_original():

assert json.dumps(results , indent=2) == json.dumps(expected, indent=2)
assert len(results_headers) == len(expected_headers) + 1

def test_getting_version_returns_valid_yaml():
import saneyaml
import scancode_config
args = ['--version']
result = run_scan_click(args)
assert saneyaml.load(result.output) == {
'ScanCode version': f'{scancode_config.__version__}',
'ScanCode Output Format version': f'{scancode_config.__output_format_version__}',
'SPDX License list version': f'{scancode_config.spdx_license_list_version}'
}