Skip to content

Commit

Permalink
Refactor: prompt string 분리 및 버젼 0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
earthicko committed Jan 26, 2023
1 parent 92e9cfa commit 64777fc
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 33 deletions.
33 changes: 33 additions & 0 deletions includes/ansi_escape.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ansi_escape.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: donghyle <donghyle@student.42seoul.kr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/22 16:43:47 by donghyle #+# #+# */
/* Updated: 2023/01/22 16:43:51 by donghyle ### ########.fr */
/* */
/* ************************************************************************** */

#ifndef ANSI_ESCAPE_H
# define ANSI_ESCAPE_H

# define ANSI_RESET "\033[0m"
# define ANSI_RED "\033[31m"
# define ANSI_GREEN "\033[32m"
# define ANSI_YELLOW "\033[33m"
# define ANSI_BLUE "\033[34m"
# define ANSI_MAGENTA "\033[35m"
# define ANSI_CYAN "\033[36m"
# define ANSI_WHITE "\033[37m"
# define ANSI_BBLACK "\033[90m"
# define ANSI_BRED "\033[91m"
# define ANSI_BGREEN "\033[92m"
# define ANSI_BYELLOW "\033[93m"
# define ANSI_BBLUE "\033[94m"
# define ANSI_BMAGENTA "\033[95m"
# define ANSI_BCYAN "\033[96m"
# define ANSI_BWHITE "\033[97m"

#endif
2 changes: 1 addition & 1 deletion modules/libenvman/srcs/envmanager_escape0.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/* ************************************************************************** */

#include "libft.h"
#include "prompt_string.h"
#include "ansi_escape.h"

char *_envman_escape_reset(void)
{
Expand Down
2 changes: 1 addition & 1 deletion modules/libenvman/srcs/envmanager_escape1.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/* ************************************************************************** */

#include "libft.h"
#include "prompt_string.h"
#include "ansi_escape.h"

char *_envman_escape_magenta(void)
{
Expand Down
2 changes: 1 addition & 1 deletion modules/libenvman/srcs/envmanager_escape2.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/* ************************************************************************** */

#include "libft.h"
#include "prompt_string.h"
#include "ansi_escape.h"

char *_envman_escape_bgreen(void)
{
Expand Down
2 changes: 1 addition & 1 deletion modules/libenvman/srcs/envmanager_escape3.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/* ************************************************************************** */

#include "libft.h"
#include "prompt_string.h"
#include "ansi_escape.h"

char *_envman_escape_bwhite(void)
{
Expand Down
30 changes: 8 additions & 22 deletions includes/prompt_string.h → srcs/prompt/prompt_banner.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* prompt_string.h :+: :+: :+: */
/* ansi_escape.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: donghyle <donghyle@student.42seoul.kr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
Expand All @@ -10,25 +10,9 @@
/* */
/* ************************************************************************** */

#ifndef PROMPT_STRING_H
# define PROMPT_STRING_H
#ifndef PROMPT_BANNER_H
# define PROMPT_BANNER_H

# define ANSI_RESET "\033[0m"
# define ANSI_RED "\033[31m"
# define ANSI_GREEN "\033[32m"
# define ANSI_YELLOW "\033[33m"
# define ANSI_BLUE "\033[34m"
# define ANSI_MAGENTA "\033[35m"
# define ANSI_CYAN "\033[36m"
# define ANSI_WHITE "\033[37m"
# define ANSI_BBLACK "\033[90m"
# define ANSI_BRED "\033[91m"
# define ANSI_BGREEN "\033[92m"
# define ANSI_BYELLOW "\033[93m"
# define ANSI_BBLUE "\033[94m"
# define ANSI_BMAGENTA "\033[95m"
# define ANSI_BCYAN "\033[96m"
# define ANSI_BWHITE "\033[97m"
# define _B_00_0 " ___ \033[0m"
# define _B_01_0 " / \033[31m/\\ \033[0m"
# define _B_02_0 " / \033[31m/::\\ \033[0m"
Expand Down Expand Up @@ -73,8 +57,10 @@
# define _B_08_3 " / \033[34m/:/ \033[0m"
# define _B_09_3 " /__\033[34m/:/ \033[0m"
# define _B_10_3 " \\__\033[34m\\/ \033[0m"
# define _B_CREDIT_0 "... \033[91md\033[0monghyle & "
# define _B_CREDIT_1 "\033[95md\033[0mahkang \033[92ms\033[94mh\033[0mell"
# define _B_VER "0.0.3"
# define _B_CREDIT_0 ""
# define _B_CREDIT_1 "| \033[91md\033[0monghyle"
# define _B_CREDIT_2 "| \033[95md\033[0mahkang"
# define _B_CREDIT_3 "| \033[92ms\033[94mh\033[0mell"
# define _B_VER "| 0.0.5"

#endif
13 changes: 6 additions & 7 deletions srcs/prompt/prompt_cosmetic.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "envmanager.h"
#include "strutils.h"
#include "msgdef.h"
#include "prompt_string.h"
#include "prompt_banner.h"

void prompt_print_banner(void)
{
Expand All @@ -25,12 +25,11 @@ void prompt_print_banner(void)
ft_printf("%s%s%s%s\n", _B_03_0, _B_03_1, _B_03_2, _B_03_3);
ft_printf("%s%s%s%s\n", _B_04_0, _B_04_1, _B_04_2, _B_04_3);
ft_printf("%s%s%s%s\n", _B_05_0, _B_05_1, _B_05_2, _B_05_3);
ft_printf("%s%s%s%s\n", _B_06_0, _B_06_1, _B_06_2, _B_06_3);
ft_printf("%s%s%s%s\n", _B_07_0, _B_07_1, _B_07_2, _B_07_3);
ft_printf("%s%s%s%s\n", _B_08_0, _B_08_1, _B_08_2, _B_08_3);
ft_printf("%s%s%s%s\n", _B_09_0, _B_09_1, _B_09_2, _B_09_3);
ft_printf("%s%s%s%s%s%s %s\n\n", _B_10_0, _B_10_1, _B_10_2, _B_10_3,
_B_CREDIT_0, _B_CREDIT_1, _B_VER);
ft_printf("%s%s%s%s %s\n", _B_06_0, _B_06_1, _B_06_2, _B_06_3, _B_CREDIT_0);
ft_printf("%s%s%s%s %s\n", _B_07_0, _B_07_1, _B_07_2, _B_07_3, _B_CREDIT_1);
ft_printf("%s%s%s%s %s\n", _B_08_0, _B_08_1, _B_08_2, _B_08_3, _B_CREDIT_2);
ft_printf("%s%s%s%s %s\n", _B_09_0, _B_09_1, _B_09_2, _B_09_3, _B_CREDIT_3);
ft_printf("%s%s%s%s %s\n\n", _B_10_0, _B_10_1, _B_10_2, _B_10_3, _B_VER);
}

char *prompt_get_prompt_prefix(void)
Expand Down

0 comments on commit 64777fc

Please sign in to comment.