cmd

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cmd implements the CobraCLI commands for the codeanalyze CLI. Subcommands for the CLI should all live within this package. Logic should be delegated to internal packages and functions to keep the CLI commands clean and focused on CLI I/O.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeAnalyze

type CodeAnalyze struct {
	Version      string
	RootFlags    config.RootFlags
	OutputConfig writer.OutputConfig
	OutputSignal signal.Signal
	RootCmd      *cobra.Command
	VersionCmd   *cobra.Command
	SemgrepCmd   *cobra.Command
}

CodeAnalyze is the main struct for the codeanalyze CLI. It contains all of the necessary fields to run the CLI and all the subcommands. It is also responsible for holding the Output configuration and the Output signal. This output signal is used to write the output of the command to the desired output format after the command has completed.

func NewCodeAnalyze

func NewCodeAnalyze(version string) *CodeAnalyze

NewCodeAnalyze creates a new CodeAnalyze struct with the given version. This struct is used throughout the execution of the codeanalyze CLI to hold the necessary fields and subcommands. We pass the version in here from the main.go file, wehre we set the version string during the build process.

func (*CodeAnalyze) InitRootCommand

func (a *CodeAnalyze) InitRootCommand()

InitRootCommand initializes the root command for the codeanalyze CLI. This command is the main entry point for the CLI the CLI and is responsible for setting up the necessary flags and subcommands. It also initializes the output configuration and signal for the CLI. Importantly, it sets up the PersistentPreRunE and PersistentPostRunE functions for the root command. These functions are critical in setting up the output configuration for the CLI and then writing that output to the desired output format.

func (*CodeAnalyze) InitSastCommand

func (a *CodeAnalyze) InitSastCommand()

InitSastCommand initializes the static analysis family of commands

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL