Compare commits
2 Commits
develop
...
4-make-ser
| Author | SHA1 | Date | |
|---|---|---|---|
| 2df54930bb | |||
| f7a1f84730 |
3
.github/workflows/rust_test.yml
vendored
3
.github/workflows/rust_test.yml
vendored
@@ -8,9 +8,6 @@ on:
|
|||||||
- "./Cargo.toml"
|
- "./Cargo.toml"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["main", "develop"]
|
branches: ["main", "develop"]
|
||||||
paths:
|
|
||||||
- "./src/**"
|
|
||||||
- "./Cargo.toml"
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|||||||
37
Cargo.lock
generated
37
Cargo.lock
generated
@@ -630,17 +630,6 @@ dependencies = [
|
|||||||
"unicode-width",
|
"unicode-width",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "colored"
|
|
||||||
version = "2.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd"
|
|
||||||
dependencies = [
|
|
||||||
"atty",
|
|
||||||
"lazy_static",
|
|
||||||
"winapi 0.3.9",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "concurrent-queue"
|
name = "concurrent-queue"
|
||||||
version = "2.1.0"
|
version = "2.1.0"
|
||||||
@@ -864,11 +853,11 @@ dependencies = [
|
|||||||
"bytes",
|
"bytes",
|
||||||
"clap 4.1.8",
|
"clap 4.1.8",
|
||||||
"clap_complete",
|
"clap_complete",
|
||||||
"colored",
|
|
||||||
"futures",
|
"futures",
|
||||||
"home",
|
"home",
|
||||||
"live-server",
|
"live-server",
|
||||||
"notify 5.1.0",
|
"notify 5.1.0",
|
||||||
|
"nu-ansi-term",
|
||||||
"regex",
|
"regex",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"text_io",
|
"text_io",
|
||||||
@@ -1872,6 +1861,15 @@ dependencies = [
|
|||||||
"windows-sys 0.42.0",
|
"windows-sys 0.42.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nu-ansi-term"
|
||||||
|
version = "0.50.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys 0.61.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-integer"
|
name = "num-integer"
|
||||||
version = "0.1.45"
|
version = "0.1.45"
|
||||||
@@ -3206,6 +3204,12 @@ version = "0.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-link"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.42.0"
|
version = "0.42.0"
|
||||||
@@ -3230,6 +3234,15 @@ dependencies = [
|
|||||||
"windows-targets",
|
"windows-targets",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.61.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||||
|
dependencies = [
|
||||||
|
"windows-link",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-targets"
|
name = "windows-targets"
|
||||||
version = "0.42.1"
|
version = "0.42.1"
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ exclude = [".gitlab", ".github"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
bytes = "1.4.0"
|
bytes = "1.4.0"
|
||||||
clap = { version = "4.1.8", features = ["derive"] }
|
clap = { version = "4.1.8", features = ["derive"] }
|
||||||
colored = "2.0.0"
|
|
||||||
futures = "0.3.26"
|
futures = "0.3.26"
|
||||||
home = "0.5.4"
|
home = "0.5.4"
|
||||||
live-server = "0.6.0"
|
live-server = "0.6.0"
|
||||||
@@ -23,3 +22,4 @@ text_io = "0.1.12"
|
|||||||
tokio = { version = "1.26.0", features = ["full"] }
|
tokio = { version = "1.26.0", features = ["full"] }
|
||||||
zip-extract = "0.1.1"
|
zip-extract = "0.1.1"
|
||||||
clap_complete = "4.1.4"
|
clap_complete = "4.1.4"
|
||||||
|
nu-ansi-term = "0.50.3"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use std::{process::Command, io::ErrorKind};
|
use nu_ansi_term::Color::{LightGray, LightGreen, LightRed};
|
||||||
use colored::Colorize;
|
use std::{io::ErrorKind, process::Command};
|
||||||
|
|
||||||
const INFO_ASCIIDOC: &str = "
|
const INFO_ASCIIDOC: &str = "
|
||||||
Install the binary with your package manager!
|
Install the binary with your package manager!
|
||||||
@@ -37,7 +37,7 @@ fn check_reveal() -> () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn reveal_is_installed() -> bool {
|
fn reveal_is_installed() -> bool {
|
||||||
return check_command("asciidoctor-revealjs")
|
return check_command("asciidoctor-revealjs");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_asciidoc() -> () {
|
fn check_asciidoc() -> () {
|
||||||
@@ -49,23 +49,21 @@ fn check_asciidoc() -> () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn asciidoc_is_installed() -> bool {
|
fn asciidoc_is_installed() -> bool {
|
||||||
return check_command("asciidoctor")
|
return check_command("asciidoctor");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_command(command: &str) -> bool {
|
fn check_command(command: &str) -> bool {
|
||||||
return match Command::new(command)
|
return match Command::new(command).output() {
|
||||||
.output() {
|
|
||||||
Ok(_) => true,
|
Ok(_) => true,
|
||||||
Err(e) => ErrorKind::NotFound != e.kind()
|
Err(e) => ErrorKind::NotFound != e.kind(),
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_health_ok(name: &str) {
|
fn print_health_ok(name: &str) {
|
||||||
println!("- ✔️ {}", name.bright_green());
|
println!("- ✔️ {}", LightGreen.paint(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_health_not_ok(name: &str, info: &str) {
|
fn print_health_not_ok(name: &str, info: &str) {
|
||||||
println!("- ❗{}", name.bright_red());
|
println!("- ❗{}", LightRed.paint(name));
|
||||||
println!("{}", info.bright_black())
|
println!("{}", LightGray.paint(info))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use colored::Colorize;
|
use nu_ansi_term::Color::Green;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use live_server::listen;
|
use live_server::listen;
|
||||||
use notify::{
|
use notify::{
|
||||||
@@ -21,15 +21,18 @@ async fn watch_and_build() {
|
|||||||
.expect("something went wrong")
|
.expect("something went wrong")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async fn start_server(port: Option<u16>) {
|
async fn start_server(port: Option<u16>) {
|
||||||
let unwrapped_port = port.unwrap_or(8080);
|
let port = port.unwrap_or(8080);
|
||||||
|
let link = &format!("http://localhost:{}", port);
|
||||||
|
let hyperlink = Green.paint(link).hyperlink(link);
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"\nServing at {}{} ",
|
"\nServing at {}",
|
||||||
"http://localhost:".bold(),
|
hyperlink
|
||||||
unwrapped_port.to_string().bold()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let Ok(()) = listen("localhost", port.unwrap_or(8080), "./dist").await else {
|
let Ok(()) = listen("localhost", port, "./dist").await else {
|
||||||
panic!("could not start server")
|
panic!("could not start server")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
use colored::Colorize;
|
use nu_ansi_term::Color::LightGreen;
|
||||||
|
use nu_ansi_term::Color::LightRed;
|
||||||
|
use nu_ansi_term::Style;
|
||||||
|
|
||||||
pub fn display_status(context1: &str, context2: &str, in_path: &str, out_path: &str) {
|
pub fn display_status(context1: &str, context2: &str, in_path: &str, out_path: &str) {
|
||||||
let colored_context = color_context(context2);
|
let colored_context = if context2 == "Error" {
|
||||||
|
LightRed.paint(context2)
|
||||||
|
} else {
|
||||||
|
LightGreen.paint(context2)
|
||||||
|
};
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"({}) [{}] {} -> {}",
|
"({}) [{}] {} -> {}",
|
||||||
context1.bold(),
|
Style::new().paint(context1),
|
||||||
colored_context,
|
colored_context,
|
||||||
in_path,
|
in_path,
|
||||||
out_path
|
out_path
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn color_context(context: &str) -> colored::ColoredString {
|
|
||||||
if context == "Error" {
|
|
||||||
return context.bright_red()
|
|
||||||
} else {
|
|
||||||
return context.bright_green()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user