myshell 2.0.0
Loading...
Searching...
No Matches
msh_prompt.h
1//
2// Created by andrew on 10/10/23.
3//
4
5#ifndef MYSHELL_MSH_PROMPT_H
6#define MYSHELL_MSH_PROMPT_H
7
8#include <string>
9
10/* SUPPORTED VARIABLES */
11// \d - the date in "YYYY-Mon-DD" format
12// \t - the current time in "HH:MM:SS" format
13// \u - the username of the current user
14// \h - the hostname of the system
15// \w - the current working directory
16// \W - the basename of the current working directory
17// \n - newline
18// \r - carriage return
19// \s - the name of the shell
20// \v - the version of the shell
21// \$ - a literal '$' prompt
22/* END OF SUPPORTED VARIABLES */
23
24constexpr auto DEFAULT_PS1 = "\033[1;38;5;250m \\u \033[1;37m| \033[1;94m\\W\033[0m";
25
26std::string expand_ps1(const std::string &ps1);
27
28std::string generate_prompt();
29
30#endif //MYSHELL_MSH_PROMPT_H
std::string generate_prompt()
Generate a prompt string.
Definition msh_prompt.cpp:114
std::string expand_ps1(const std::string &ps1)
Expand a PS1 (Prompt String 1) format string into its corresponding values.
Definition msh_prompt.cpp:42