interactivity

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package interactivity provides functions to handle interactive command-line interfaces.

It includes utilities for prompting users for confirmation and reading their input in a context-aware manner, which allows for graceful cancellation of input requests. The package is designed to integrate with a filesystem interface to check for file existence and handle potential file overwrites.

Copyright (c) 2023 H0llyW00dzZ

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfirmOverwrite

func ConfirmOverwrite(rfs filesystem.FileSystem, ctx context.Context, reader *bufio.Reader, fileName string) (bool, error)

ConfirmOverwrite checks if a file with the given fileName exists in the provided filesystem. If the file does exist, it prompts the user for confirmation to overwrite the file. The function reads the user's input via the provided bufio.Reader and expects a 'yes' or 'no' response. A context.Context is used to handle cancellation of the input request. It returns a boolean indicating whether the file should be overwritten and any error encountered.

Types

This section is empty.

Jump to

Keyboard shortcuts

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