99from cycode .cli import code_scanner
1010from cycode .cli .auth .auth_command import authenticate
1111from cycode .cli .config import config
12- from cycode .cli .consts import ISSUE_DETECTED_STATUS_CODE , NO_ISSUES_STATUS_CODE , PROGRAM_NAME
12+ from cycode .cli .consts import CLI_CONTEXT_SETTINGS , ISSUE_DETECTED_STATUS_CODE , NO_ISSUES_STATUS_CODE , PROGRAM_NAME
1313from cycode .cli .models import Severity
1414from cycode .cli .user_settings .configuration_manager import ConfigurationManager
1515from cycode .cli .user_settings .credentials_manager import CredentialsManager
2525if TYPE_CHECKING :
2626 from cycode .cyclient .scan_client import ScanClient
2727
28- CONTEXT = {}
29-
3028
3129@click .group (
3230 commands = {
3634 'pre_commit' : code_scanner .pre_commit_scan ,
3735 'pre_receive' : code_scanner .pre_receive_scan ,
3836 },
39- short_help = 'Scan content for secrets /IaC/sca /SAST violations. '
40- 'You need to specify which scan type: ci/commit_history/path/repository/etc' ,
37+ short_help = 'Scan the content for Secrets /IaC/SCA /SAST violations. '
38+ 'You`ll need to specify which scan type to perform : ci/commit_history/path/repository/etc. ' ,
4139)
4240@click .option (
4341 '--scan-type' ,
4442 '-t' ,
4543 default = 'secret' ,
46- help = """
47- \b
48- Specify the scan you wish to execute (secret/iac/sca),
49- the default is secret
50- """ ,
44+ help = 'Specify the type of scan you wish to execute (the default is Secrets)' ,
5145 type = click .Choice (config ['scans' ]['supported_scans' ]),
5246)
5347@click .option (
5448 '--secret' ,
5549 default = None ,
56- help = 'Specify a Cycode client secret for this specific scan execution' ,
50+ help = 'Specify a Cycode client secret for this specific scan execution. ' ,
5751 type = str ,
5852 required = False ,
5953)
6054@click .option (
6155 '--client-id' ,
6256 default = None ,
63- help = 'Specify a Cycode client ID for this specific scan execution' ,
57+ help = 'Specify a Cycode client ID for this specific scan execution. ' ,
6458 type = str ,
6559 required = False ,
6660)
6761@click .option (
68- '--show-secret' , is_flag = True , default = False , help = 'Show secrets in plain text' , type = bool , required = False
62+ '--show-secret' , is_flag = True , default = False , help = 'Show Secrets in plain text. ' , type = bool , required = False
6963)
7064@click .option (
7165 '--soft-fail' ,
7266 is_flag = True ,
7367 default = False ,
74- help = 'Run scan without failing, always return a non-error status code' ,
68+ help = 'Run the scan without failing; always return a non-error status code. ' ,
7569 type = bool ,
7670 required = False ,
7771)
7872@click .option (
7973 '--severity-threshold' ,
8074 default = None ,
81- help = 'Show only violations at the specified level or higher (supported for SCA scan type only).' ,
75+ help = 'Show violations only for the specified level or higher (supported for SCA scan types only).' ,
8276 type = click .Choice ([e .name for e in Severity ]),
8377 required = False ,
8478)
8579@click .option (
8680 '--sca-scan' ,
8781 default = None ,
88- help = 'Specify the sca scan you wish to execute (package-vulnerabilities/license-compliance), the default is both' ,
82+ help = 'Specify the type of SCA scan you wish to execute (the default is both). ' ,
8983 multiple = True ,
9084 type = click .Choice (config ['scans' ]['supported_sca_scans' ]),
9185)
9286@click .option (
9387 '--monitor' ,
9488 is_flag = True ,
9589 default = False ,
96- help = "When specified, the scan results will be recorded in the knowledge graph. "
97- "Please note that when working in 'monitor' mode, the knowledge graph "
98- "will not be updated as a result of SCM events (Push, Repo creation).(supported for SCA scan type only)." ,
90+ help = 'Used for SCA scan types only; when specified, the scan results are recorded in the Discovery module.' ,
9991 type = bool ,
10092 required = False ,
10193)
10294@click .option (
10395 '--report' ,
10496 is_flag = True ,
10597 default = False ,
106- help = 'When specified, a violations report will be generated. '
107- 'A URL link to the report will be printed as an output to the command execution' ,
98+ help = 'When specified, generates a violations report. A link to the report will be displayed in the console output.' ,
10899 type = bool ,
109100 required = False ,
110101)
@@ -121,6 +112,7 @@ def code_scan(
121112 monitor : bool ,
122113 report : bool ,
123114) -> int :
115+ """Scans for Secrets, IaC, SCA or SAST violations."""
124116 if show_secret :
125117 context .obj ['show_secret' ] = show_secret
126118 else :
@@ -139,9 +131,6 @@ def code_scan(
139131
140132 _sca_scan_to_context (context , sca_scan )
141133
142- context .obj ['progress_bar' ] = get_progress_bar (hidden = context .obj ['no_progress_meter' ])
143- context .obj ['progress_bar' ].start ()
144-
145134 return 1
146135
147136
@@ -162,7 +151,7 @@ def finalize(context: click.Context, *_, **__) -> None:
162151 sys .exit (exit_code )
163152
164153
165- @click .command (short_help = 'Show the version and exit' )
154+ @click .command (short_help = 'Show the CLI version and exit. ' )
166155@click .pass_context
167156def version (context : click .Context ) -> None :
168157 output = context .obj ['output' ]
@@ -186,32 +175,32 @@ def version(context: click.Context) -> None:
186175 'auth' : authenticate ,
187176 'version' : version ,
188177 },
189- context_settings = CONTEXT ,
178+ context_settings = CLI_CONTEXT_SETTINGS ,
190179)
191180@click .option (
192181 '--verbose' ,
193182 '-v' ,
194183 is_flag = True ,
195184 default = False ,
196- help = 'Show detailed logs' ,
185+ help = 'Show detailed logs. ' ,
197186)
198187@click .option (
199188 '--no-progress-meter' ,
200189 is_flag = True ,
201190 default = False ,
202- help = 'Do not show the progress meter' ,
191+ help = 'Do not show the progress meter. ' ,
203192)
204193@click .option (
205194 '--output' ,
206195 '-o' ,
207196 default = 'text' ,
208- help = 'Specify the output (text/json/table), the default is text' ,
197+ help = 'Specify the output type ( the default is text). ' ,
209198 type = click .Choice (['text' , 'json' , 'table' ]),
210199)
211200@click .option (
212201 '--user-agent' ,
213202 default = None ,
214- help = 'Characteristic JSON object that lets servers identify the application' ,
203+ help = 'Characteristic JSON object that lets servers identify the application. ' ,
215204 type = str ,
216205)
217206@click .pass_context
@@ -232,7 +221,7 @@ def main_cli(
232221 if output == 'json' :
233222 no_progress_meter = True
234223
235- context .obj ['no_progress_meter ' ] = no_progress_meter
224+ context .obj ['progress_bar ' ] = get_progress_bar ( hidden = no_progress_meter )
236225
237226 if user_agent :
238227 user_agent_option = UserAgentOptionScheme ().loads (user_agent )
0 commit comments