Documentation
¶
Index ¶
- func FindProjectKanukaRoot() (string, error)
- func FormatPaths(paths []string) string
- func GenerateDeviceName(existingDeviceNames []string) (string, error)
- func GetHostname() (string, error)
- func GetProjectName() (string, error)
- func GetUsername() (string, error)
- func IsTTYAvailable() bool
- func IsTerminal() bool
- func IsValidEmail(email string) bool
- func ReadPassphrase(prompt string) ([]byte, error)
- func ReadPassphraseFromTTY(prompt string) ([]byte, error)
- func ReadStdin() ([]byte, error)
- func SanitizeDeviceName(name string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindProjectKanukaRoot ¶
FindProjectKanukaRoot traverses up directories to find the project's Kanuka root. Returns the path to the project root if found, empty string otherwise. Stops searching when it reaches the user's home directory.
func FormatPaths ¶
FormatPaths formats a slice of paths into a readable string.
func GenerateDeviceName ¶ added in v1.0.0
GenerateDeviceName generates a device name based on the system hostname. It sanitizes the hostname and checks for conflicts with existing device names. If a conflict is found, it appends a number suffix (-2, -3, etc.).
func GetHostname ¶ added in v1.0.0
GetHostname returns the system hostname.
func GetProjectName ¶
GetProjectName returns the name of the current project (directory).
func IsTTYAvailable ¶ added in v1.0.0
func IsTTYAvailable() bool
IsTTYAvailable returns true if /dev/tty (or CON on Windows) is available for reading.
func IsTerminal ¶ added in v1.0.0
func IsTerminal() bool
IsTerminal returns true if stdin is a terminal.
func IsValidEmail ¶ added in v1.0.0
IsValidEmail checks if the given string is a valid email address format.
func ReadPassphrase ¶ added in v1.0.0
ReadPassphrase prompts the user for a passphrase without echoing input. Returns an error if stdin is not a terminal.
func ReadPassphraseFromTTY ¶ added in v1.0.0
ReadPassphraseFromTTY prompts the user for a passphrase from /dev/tty (or CON on Windows). This is useful when stdin is being used for other input (e.g., piping a private key). Returns an error if /dev/tty cannot be opened.
func ReadStdin ¶ added in v1.0.0
ReadStdin reads all content from stdin. Returns an error if stdin is empty, is a terminal (no piped data), or cannot be read.
func SanitizeDeviceName ¶ added in v1.0.0
SanitizeDeviceName sanitizes a device name by removing special characters and converting spaces to hyphens.
Types ¶
This section is empty.