utils

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package utils provides common utility functions for the BastionBuddy application, including menu handling, user input, and Azure CLI command execution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AzureCommand

func AzureCommand(args ...string) ([]byte, error)

AzureCommand executes an Azure CLI command with the given arguments. It returns the command output and any error that occurred.

func AzureInteractiveCommand

func AzureInteractiveCommand(args ...string) error

AzureInteractiveCommand executes an Azure CLI command that requires user interaction. It returns any error that occurred during command execution.

func AzureSetSubscription

func AzureSetSubscription(subscriptionID string) error

AzureSetSubscription sets the active Azure subscription. It returns any error that occurred during the operation.

func CheckDependencies

func CheckDependencies() error

CheckDependencies verifies that all required external dependencies are available. Currently checks for the Azure CLI (az) command.

func ExtractIDFromParentheses

func ExtractIDFromParentheses(input string) (string, error)

ExtractIDFromParentheses extracts an ID from a string that contains it within parentheses. For example, "Resource Group (12345)" returns "12345".

func ReadInput

func ReadInput(prompt string) (string, error)

ReadInput prompts the user for input with the given prompt text. It returns the user's input and any error that occurred.

func SelectWithMenu

func SelectWithMenu(items []string, prompt string) (string, error)

SelectWithMenu presents an interactive menu to the user with the given items and prompt. It returns the selected item and any error that occurred.

Types

This section is empty.

Jump to

Keyboard shortcuts

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