Compare commits
4 Commits
40d98cdbb6
...
ebfda949ea
Author | SHA1 | Date | |
---|---|---|---|
ebfda949ea | |||
984d1f3aed | |||
8710c31c1f | |||
f4eeb3d0e1 |
@ -1,3 +1,11 @@
|
|||||||
|
// _____ _ _____
|
||||||
|
// |_ _|____ _| ||_ _|_ __
|
||||||
|
// | |/ _ \ \/ / __|| | \ \ / /
|
||||||
|
// | | __/> <| |_ | | \ V /
|
||||||
|
// |_|\___/_/\_\\__||_| \_/
|
||||||
|
// Author: Love Billenius <lovebillenius@disroot.org>
|
||||||
|
// License: GPL-3
|
||||||
|
|
||||||
#include "Command.h"
|
#include "Command.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
// _____ _ _____
|
||||||
|
// |_ _|____ _| ||_ _|_ __
|
||||||
|
// | |/ _ \ \/ / __|| | \ \ / /
|
||||||
|
// | | __/> <| |_ | | \ V /
|
||||||
|
// |_|\___/_/\_\\__||_| \_/
|
||||||
|
// Author: Love Billenius <lovebillenius@disroot.org>
|
||||||
|
// License: GPL-3
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -50,7 +50,9 @@ void italize_numbers(std::string &content, size_t leave_chars = 0) {
|
|||||||
|
|
||||||
void pretty_format_page(std::string &content) {
|
void pretty_format_page(std::string &content) {
|
||||||
content.insert(0, ansi::BOLD);
|
content.insert(0, ansi::BOLD);
|
||||||
const size_t line_end = content.find("\n");
|
size_t line_end = content.find('\n');
|
||||||
|
if (line_end == std::string::npos)
|
||||||
|
line_end = content.size();
|
||||||
content.insert(line_end, ansi::CLEAR);
|
content.insert(line_end, ansi::CLEAR);
|
||||||
|
|
||||||
italize_numbers(content, line_end + ansi::CLEAR.size());
|
italize_numbers(content, line_end + ansi::CLEAR.size());
|
||||||
|
17
src/Tui.cpp
17
src/Tui.cpp
@ -1,3 +1,11 @@
|
|||||||
|
// _____ _ _____
|
||||||
|
// |_ _|____ _| ||_ _|_ __
|
||||||
|
// | |/ _ \ \/ / __|| | \ \ / /
|
||||||
|
// | | __/> <| |_ | | \ V /
|
||||||
|
// |_|\___/_/\_\\__||_| \_/
|
||||||
|
// Author: Love Billenius <lovebillenius@disroot.org>
|
||||||
|
// License: GPL-3
|
||||||
|
|
||||||
#include "Tui.h"
|
#include "Tui.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -46,7 +54,14 @@ void Tui::run() {
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
std::cout << "Enter a command: ";
|
std::cout << "Enter a command: ";
|
||||||
std::flush(std::cout);
|
std::flush(std::cout);
|
||||||
const Command::Command command = Command::readCommand();
|
Command::Command command;
|
||||||
|
try {
|
||||||
|
command = Command::readCommand();
|
||||||
|
} catch (const Command::NoNumberException &e) {
|
||||||
|
std::cout << e.what() << std::endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool should_exit = false;
|
bool should_exit = false;
|
||||||
auto visitor = [this, &should_exit]<typename T0>(T0 &&arg) {
|
auto visitor = [this, &should_exit]<typename T0>(T0 &&arg) {
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
// _____ _ _____
|
||||||
|
// |_ _|____ _| ||_ _|_ __
|
||||||
|
// | |/ _ \ \/ / __|| | \ \ / /
|
||||||
|
// | | __/> <| |_ | | \ V /
|
||||||
|
// |_|\___/_/\_\\__||_| \_/
|
||||||
|
// Author: Love Billenius <lovebillenius@disroot.org>
|
||||||
|
// License: GPL-3
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Page.hpp"
|
#include "Page.hpp"
|
||||||
|
|
||||||
|
18
src/ansi.hpp
18
src/ansi.hpp
@ -1,11 +1,17 @@
|
|||||||
|
// _____ _ _____
|
||||||
|
// |_ _|____ _| ||_ _|_ __
|
||||||
|
// | |/ _ \ \/ / __|| | \ \ / /
|
||||||
|
// | | __/> <| |_ | | \ V /
|
||||||
|
// |_|\___/_/\_\\__||_| \_/
|
||||||
|
// Author: Love Billenius <lovebillenius@disroot.org>
|
||||||
|
// License: GPL-3
|
||||||
|
|
||||||
namespace ansi
|
#pragma once
|
||||||
{
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
constexpr std::string_view BOLD = "\033[1m";
|
namespace ansi {
|
||||||
constexpr std::string_view ITALIC = "\033[3m";
|
constexpr std::string_view BOLD = "\033[1m";
|
||||||
constexpr std::string_view CLEAR = "\033[0m";
|
constexpr std::string_view ITALIC = "\033[3m";
|
||||||
|
constexpr std::string_view CLEAR = "\033[0m";
|
||||||
} // namespace ansi
|
} // namespace ansi
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
// _____ _ _____
|
||||||
|
// |_ _|____ _| ||_ _|_ __
|
||||||
|
// | |/ _ \ \/ / __|| | \ \ / /
|
||||||
|
// | | __/> <| |_ | | \ V /
|
||||||
|
// |_|\___/_/\_\\__||_| \_/
|
||||||
|
// Author: Love Billenius <lovebillenius@disroot.org>
|
||||||
|
// License: GPL-3
|
||||||
|
|
||||||
#include "Page.hpp"
|
#include "Page.hpp"
|
||||||
#include "Tui.h"
|
#include "Tui.h"
|
||||||
|
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
// _____ _ _____
|
||||||
|
// |_ _|____ _| ||_ _|_ __
|
||||||
|
// | |/ _ \ \/ / __|| | \ \ / /
|
||||||
|
// | | __/> <| |_ | | \ V /
|
||||||
|
// |_|\___/_/\_\\__||_| \_/
|
||||||
|
// Author: Love Billenius <lovebillenius@disroot.org>
|
||||||
|
// License: GPL-3
|
||||||
|
|
||||||
#include "stringutil.hpp"
|
#include "stringutil.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
// _____ _ _____
|
||||||
|
// |_ _|____ _| ||_ _|_ __
|
||||||
|
// | |/ _ \ \/ / __|| | \ \ / /
|
||||||
|
// | | __/> <| |_ | | \ V /
|
||||||
|
// |_|\___/_/\_\\__||_| \_/
|
||||||
|
// Author: Love Billenius <lovebillenius@disroot.org>
|
||||||
|
// License: GPL-3
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user