Foss CLI¶
CLI commands
The foss_cli cmdline interface uses the provided REST-API to communicate with the Fossology Server. Logging is implemented using the standard python logging framework. Log Level can be adapted using the -v/-vv option to foss_cli. Logging could be sent to console (option –log_to_file) and/or to a log_file (option –log_to_file). The name of the log_file (default is .foss_cli.log) could be adapted using the option –log_file_name <filename>.
- fossology.foss_cli.check_get_access_level(level: str)¶
Check if the given level is a valid AccessLevel value.
- Parameters:
level – name of a Access level
- Type:
str
- Returns:
AccessLevel
- Return type:
Enum
- fossology.foss_cli.check_get_folder(ctx: Context, folder_name: str)¶
Get a Folder Instance based on the Folders name.
- Parameters:
ctx (click.core.Context) – click context
folder_name (str) – the name of the folder
- Returns:
the requested Folder
- Return type:
Folder()
- Raises:
FossologyUnsupported – if folder_name is (not or multiple times) found.
- fossology.foss_cli.check_get_report_format(format: str)¶
Check if the given format is a valid ReportFormat value.
- Parameters:
format (str) – name of a ReportFormat
- Returns:
ReportFormat
- Return type:
Enum
- fossology.foss_cli.get_newest_upload_of_file(ctx: Context, filename: str, folder_name: str)¶
Given a filename and folder_name return the newest upload if available.
- Parameters:
ctx (click.core.Context) – click Context
filename (str) – str
folder_name (str) – str
- Returns:
Upload Instance or None
- Return type:
Upload or None
- fossology.foss_cli.init_foss(ctx: Context)¶
Initialize a Fossology Instance and store it in the context.
- Parameters:
ctx (click.core.Context) – click Context
- Raises:
e – KeyError Bearer TOKEN not set in environment
- Returns:
foss_instance
- Return type:
- fossology.foss_cli.needs_later_initialization_of_foss_instance(ctx: Context)¶
Check if later on a Fossology Instance will be created.
- Parameters:
ctx (click.core.Context) – click context
- Returns:
Indicator
- Return type:
bool