cmd

package
v0.0.3 Latest Latest
Warning

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

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

Documentation

Overview

Package cmd implements the CobraCLI commands for the infrascan 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 Infrascan

type Infrascan struct {
	Version      string
	OutputConfig writer.OutputConfig
	OutputSignal signal.Signal
	RootFlags    config.RootFlags
	RootCmd      *cobra.Command
	VersionCmd   *cobra.Command
	DNSCmd       *cobra.Command
	SaasCmd      *cobra.Command
	ShodanCmd    *cobra.Command
}

Infrascan is the main struct for the CLI. It contains the version, output configuration, output signal, and root flags for the CLI. It also contains all commands and subcommands for the CLI. The output signal is used to write the output of the command to the desired output format after the execution of the invoked command's Run function.

func NewInfrascan

func NewInfrascan(version string) *Infrascan

NewInfrascan creates a new infrascan struct with the given version. It initializes the root command and all subcommands for the CLI. We pass the version command in here from the main.go file, where we set the version string during the build process.

func (*Infrascan) InitDiscoverCommand

func (a *Infrascan) InitDiscoverCommand()

func (*Infrascan) InitRootCommand

func (a *Infrascan) InitRootCommand()

InitRootCommand initializes the root command for the Infrascan CLI. This function initializes the root command with a PersistentPreRunE function that is responsible for setting the output configuration properly, as well as a PersistentPostRunE function that is responsible for writing the output signal to the desired output format.

Jump to

Keyboard shortcuts

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