Skip to content

Commit 5d7ae29

Browse files
fixed non interactive mode and bumped version 0.0.3
1 parent 2298271 commit 5d7ae29

File tree

6 files changed

+28
-15
lines changed

6 files changed

+28
-15
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,21 @@ jobs:
3636
- name: Install cosign
3737
uses: sigstore/[email protected]
3838
with:
39-
inputs: dist/scsctl-0.0.2-py3-none-any.whl
39+
inputs: dist/scsctl-0.0.3-py3-none-any.whl
4040
- name: Sign with sigstore using GitHub App credentials
4141
run: |
42-
sigstore sign --overwrite dist/scsctl-0.0.2-py3-none-any.whl
42+
sigstore sign --overwrite dist/scsctl-0.0.3-py3-none-any.whl
4343
- name: Archive production artifacts
4444
uses: actions/upload-artifact@v3
4545
with:
4646
name: dist
4747
path: |
4848
dist
49-
- name: Copy dist/scsctl-0.0.2.tar.gz dist/scsctl-0.0.2-py3-none-any.whl to release directory
49+
- name: Copy dist/scsctl-0.0.3.tar.gz dist/scsctl-0.0.3-py3-none-any.whl to release directory
5050
run: |
5151
mkdir -p release
52-
cp dist/scsctl-0.0.2.tar.gz release/scsctl-0.0.2.tar.gz
53-
cp dist/scsctl-0.0.2-py3-none-any.whl release/scsctl-0.0.2-py3-none-any.whl
52+
cp dist/scsctl-0.0.3.tar.gz release/scsctl-0.0.3.tar.gz
53+
cp dist/scsctl-0.0.3-py3-none-any.whl release/scsctl-0.0.3-py3-none-any.whl
5454
5555
- name: Publish distribution 📦 to Test PyPI
5656
uses: pypa/gh-action-pypi-publish@release/v1

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "scsctl"
7-
version = "0.0.2"
7+
version = "0.0.3"
88
authors = [{name="Jegath S", email="[email protected]" }]
99
description = "Tool for automating Vulnerability Risk Management and Software Supply Chain Security Measures"
1010
readme = "README.md"

src/scsctl/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@ def scan(
164164
if(non_interactive):
165165
click.echo("Sbom report")
166166
click.echo("===========")
167-
print_sbom_report(sbom_report)
167+
print_sbom_report(sbom_report = sbom_report,is_non_interactive = True)
168168
click.echo("Pyroscope detected packages")
169169
click.echo("===========================")
170-
print_pyroscope_packages(pyroscope_data)
170+
print_pyroscope_packages(pyroscope_package_names = pyroscope_data,is_non_interactive = True)
171171
if falco_enabled:
172172
click.echo("Falco detected packages")
173173
click.echo("=======================")
174-
print_falco_packages(falco_found_extra_packages)
174+
print_falco_packages(falco_package_names = falco_found_extra_packages,is_non_interactive = True)
175175
click.echo("Final Report")
176176
click.echo("=============")
177177
click.echo(final_report)

src/scsctl/helper/falco.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,22 @@ def compare_and_find_extra_packages_using_falco(falco_package_names, sbom_packag
6969
return extra_packages
7070

7171

72-
def print_falco_packages(falco_package_names):
72+
def print_falco_packages(falco_package_names,is_non_interactive=False):
7373
headers = ["Packages"]
7474
data = []
7575
for item in falco_package_names:
7676
data.append([item])
7777

78+
width = [100]
79+
80+
if is_non_interactive:
81+
print(tabulate(data, headers=headers, tablefmt="grid",maxcolwidths=width, showindex=list(range(1, len(data) + 1))))
82+
return
83+
84+
7885
chunk_size = 200
7986
index = 0
8087

81-
width = [100]
8288

8389
while index < len(data):
8490
table = tabulate(

src/scsctl/helper/pyroscope.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def get_pyroscope_data(app_details: AppDetails):
2424
return [], False
2525

2626

27-
def print_pyroscope_packages(pyroscope_package_names):
27+
def print_pyroscope_packages(pyroscope_package_names,is_non_interactive = False):
2828
if "total" in pyroscope_package_names:
2929
pyroscope_package_names.remove("total")
3030
if "other" in pyroscope_package_names:
@@ -33,11 +33,15 @@ def print_pyroscope_packages(pyroscope_package_names):
3333
data = []
3434
for item in pyroscope_package_names:
3535
data.append([item])
36+
37+
width = [100]
38+
if is_non_interactive:
39+
print(tabulate(data, headers=headers, tablefmt="grid",maxcolwidths=width, showindex=list(range(1, len(data) + 1))))
40+
return
3641

3742
chunk_size = 200
3843
index = 0
3944

40-
width = [100]
4145

4246
while index < len(data):
4347
table = tabulate(

src/scsctl/helper/trivy.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def get_sbom_report(app_details: AppDetails):
4545
return "", False
4646

4747

48-
def print_sbom_report(sbom_report):
48+
def print_sbom_report(sbom_report,is_non_interactive=False):
4949
sbom_report = json.loads(sbom_report)
5050
sbom_report = sbom_report["Results"]
5151
sbom_report = [item["Vulnerabilities"] for item in sbom_report if item["Class"] != "lang-pkgs"][0]
@@ -71,7 +71,10 @@ def print_sbom_report(sbom_report):
7171

7272
# Change width of the columns (First width is for the index column)
7373
width = [10, 20, 20, 20, 10, 10, 80]
74-
# print(data)
74+
75+
if is_non_interactive:
76+
print(tabulate(data, headers=headers, tablefmt="grid",maxcolwidths=width, showindex=list(range(1, len(data) + 1))))
77+
return
7578

7679
while index < len(data):
7780
table = tabulate(

0 commit comments

Comments
 (0)