From 0a76fab5b237684a5a25448cbd5fbe7fc1f44259 Mon Sep 17 00:00:00 2001 From: eidheim Date: Thu, 1 Apr 2021 10:30:04 +0200 Subject: [PATCH] Added platform specific instructions for installing prettier --- src/source.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/source.cpp b/src/source.cpp index 655d774..0d9bdb9 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -733,7 +733,18 @@ void Source::View::setup_format_style(bool is_generic_view) { static bool shown = false; if(!shown) { Terminal::get().print("\e[33mWarning\e[m: could not find Prettier code formatter.\n"); - Terminal::get().print("To install Prettier, run the following command in a terminal: npm i -g prettier\n"); + Terminal::get().print("To install Prettier, run the following command in a terminal: "); +#if defined(__APPLE__) + Terminal::get().print("brew install prettier"); +#elif defined(__linux) + if(!filesystem::find_executable("pacman").empty()) + Terminal::get().print("sudo pacman -S prettier"); + else + Terminal::get().print("npm i -g prettier"); +#else + Terminal::get().print("npm i -g prettier"); +#endif + Terminal::get().print("\n"); } shown = true; }