Skip to content

Commit 0405c6b

Browse files
authored
CM-47493 - Make changes in CLI v3.0.0 after feedback (#299)
1 parent 6c70c21 commit 0405c6b

File tree

21 files changed

+214
-90
lines changed

21 files changed

+214
-90
lines changed

cycode/cli/app.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import Annotated, Optional
44

55
import typer
6+
from typer import rich_utils
67
from typer.completion import install_callback, show_callback
78

89
from cycode import __version__
@@ -18,11 +19,18 @@
1819
from cycode.cyclient.models import UserAgentOptionScheme
1920
from cycode.logger import set_logging_level
2021

22+
# By default, it uses dim style which is hard to read with the combination of color from RICH_HELP
23+
rich_utils.STYLE_ERRORS_SUGGESTION = 'bold'
24+
# By default, it uses blue color which is too dark for some terminals
25+
rich_utils.RICH_HELP = "Try [cyan]'{command_path} {help_option}'[/] for help."
26+
27+
2128
app = typer.Typer(
2229
pretty_exceptions_show_locals=False,
2330
pretty_exceptions_short=True,
2431
context_settings=CLI_CONTEXT_SETTINGS,
2532
rich_markup_mode='rich',
33+
no_args_is_help=True,
2634
add_completion=False, # we add it manually to control the rich help panel
2735
)
2836

cycode/cli/apps/ai_remediation/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from cycode.cli.apps.ai_remediation.ai_remediation_command import ai_remediation_command
44

5-
app = typer.Typer()
5+
app = typer.Typer(no_args_is_help=True)
66
app.command(name='ai-remediation', short_help='Get AI remediation (INTERNAL).', hidden=True)(ai_remediation_command)
77

88
# backward compatibility

cycode/cli/apps/auth/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
app = typer.Typer(
77
name='auth',
88
help='Authenticate your machine to associate the CLI with your Cycode account.',
9+
no_args_is_help=True,
910
)
1011
app.callback(invoke_without_command=True)(auth_command)
1112
app.command(name='check')(check_command)

cycode/cli/apps/configure/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from cycode.cli.apps.configure.configure_command import configure_command
44

5-
app = typer.Typer()
5+
app = typer.Typer(no_args_is_help=True)
66
app.command(name='configure', short_help='Initial command to configure your CLI client authentication.')(
77
configure_command
88
)

cycode/cli/apps/ignore/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
from cycode.cli.apps.ignore.ignore_command import ignore_command
44

5-
app = typer.Typer()
5+
app = typer.Typer(no_args_is_help=True)
66
app.command(name='ignore', short_help='Ignores a specific value, path or rule ID.')(ignore_command)

cycode/cli/apps/report/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
from cycode.cli.apps.report import sbom
44
from cycode.cli.apps.report.report_command import report_command
55

6-
app = typer.Typer(name='report')
6+
app = typer.Typer(name='report', no_args_is_help=True)
77
app.callback(short_help='Generate report. You`ll need to specify which report type to perform.')(report_command)
88
app.add_typer(sbom.app)

cycode/cli/apps/scan/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from cycode.cli.apps.scan.repository.repository_command import repository_command
88
from cycode.cli.apps.scan.scan_command import scan_command, scan_command_result_callback
99

10-
app = typer.Typer(name='scan')
10+
app = typer.Typer(name='scan', no_args_is_help=True)
1111

1212
app.callback(
1313
short_help='Scan the content for Secrets, IaC, SCA, and SAST violations.',

cycode/cli/apps/status/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
from cycode.cli.apps.status.status_command import status_command
44
from cycode.cli.apps.status.version_command import version_command
55

6-
app = typer.Typer()
6+
app = typer.Typer(no_args_is_help=True)
77
app.command(name='status', short_help='Show the CLI status and exit.')(status_command)
88
app.command(name='version', hidden=True, short_help='Alias to status command.')(version_command)

cycode/cli/cli_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,6 @@ def __rich__(self) -> str:
9494
SeverityOption.INFO.value: ':blue_circle:',
9595
SeverityOption.LOW.value: ':yellow_circle:',
9696
SeverityOption.MEDIUM.value: ':orange_circle:',
97-
SeverityOption.HIGH.value: ':heavy_large_circle:',
98-
SeverityOption.CRITICAL.value: ':red_circle:',
97+
SeverityOption.HIGH.value: ':red_circle:',
98+
SeverityOption.CRITICAL.value: ':exclamation_mark:', # double_exclamation_mark is not red
9999
}

cycode/cli/files_collector/sca/npm/restore_npm_dependencies.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ def get_lock_file_name(self) -> str:
3737
def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
3838
return os.path.isfile(restore_file_path)
3939

40-
def prepare_manifest_file_path_for_command(self, manifest_file_path: str) -> str:
40+
@staticmethod
41+
def prepare_manifest_file_path_for_command(manifest_file_path: str) -> str:
4142
return manifest_file_path.replace(os.sep + NPM_MANIFEST_FILE_NAME, '')

0 commit comments

Comments
 (0)