shPrompt: Replicate Terminal Prompts Seen in a Few Common Shells

shPromptR Documentation

Replicate Terminal Prompts Seen in a Few Common Shells

Description

Get the prompt seen at Windows cmd, Windows Powershell, Bash, and macOS Bash (bash 3.0). The function will return whichever is most appropriate, unless over-ridden by its argument

Usage

shPrompt(type = NULL)

Arguments

type

NULL or a character string; the shell prompt to return.

Details

The choices of type are "windows", "cmd", "powershell", "macOS", "bash", "ubuntu", and "unix", with case insensitive partial matching.

If type is a character string, it is matched against the above choices. If type is NULL or does not match one of the above choices, type is pulled from option essentials::shPrompt(type). If this option is NULL or does not match one of the above choices, type is pulled from environment variable R_ESSENTIALS_SH_PROMPT_TYPE. If this environment variable is unset or does not match one of the above choices, type is determined by .Platform$OS.type and capabilities("aqua").

Value

character string.

Examples

cat(
    essentials::shPrompt("cmd"       ),
    essentials::shPrompt("powershell"),
    essentials::shPrompt("macOS"     ),
    essentials::shPrompt("bash"      ),
    sep = "\n"
)

ArcadeAntics/essentials documentation built on Nov. 7, 2024, 4:33 p.m.