cmd

package
v0.0.0-...-7dbec7d Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package cmd implements the CobraCLI commands for the webassess 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 WebAssess

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

WebAssess is the main struct for the webassess CLI. It contains both the root command and all subcommands that can be invoked during the execution of the CLI. It also is responsible for managing the output configuration as well as the output signal itself, which will be written after the execution of the invoked command's Run function.

func NewWebAssess

func NewWebAssess(version string) *WebAssess

NewWebAssess creates a new webassess struct with the provided version string. The webassess struct is used throughout the subcommands as a contex within which output results and configuration values can be stored. We pass the version value in from the main.go file, where we set the version string during the build process.

func (*WebAssess) InitRootCommand

func (a *WebAssess) InitRootCommand()

InitRootCommand initializes the root command for the webassess CLI. This command is the parent command for all other subcommands that can be invoked. It also sets up the version command, which prints the version of the CLI when invoked. The root command also sets up the output configuration and signal, which are used to write the output of the subcommands to the appropriate location (file or stdout). Here, we set the PersistentPreRunE and PersistentPostRunE functions that are propagated to all subcommands. These functions are used to set up the output configuration and signal before the command is run, and to write the output signal after the command has completed.

func (*WebAssess) InitURLAssess

func (a *WebAssess) InitURLAssess()

InitURLAssess initializes the url command for the webassess CLI. This command is used to perform dynamic analysis of the contents and files hosted on a URL.

Jump to

Keyboard shortcuts

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