Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: make component formatting more standard #64

Merged
merged 13 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/template.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
[values]
gh-username = "ratatui"
project-description = "Example of ratatui template"
msrv = "nightly"
use_gitserver = false
crossterm_io = "stderr"
use_rustfmt = false
3 changes: 0 additions & 3 deletions component/.github/workflows/template.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
[values]
gh-username = "kdheepak"
project-description = "Example of ratatui template"
msrv = "stable"
use_gitserver = false
crossterm_io = "stderr"
use_rustfmt = false
16 changes: 0 additions & 16 deletions component/template/.rustfmt.toml

This file was deleted.

1 change: 0 additions & 1 deletion component/template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ human-panic = "1.2.0"
json5 = "0.4.1"
lazy_static = "1.4.0"
libc = "0.2.148"
log = "0.4.20"
pretty_assertions = "1.4.0"
ratatui = { version = "0.27.0", features = ["serde", "macros"] }
serde = { version = "1.0.188", features = ["derive"] }
Expand Down
7 changes: 5 additions & 2 deletions component/template/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
vergen::EmitBuilder::builder().all_build().all_git().emit()?;
Ok(())
vergen::EmitBuilder::builder()
.all_build()
.all_git()
.emit()?;
Ok(())
}
34 changes: 0 additions & 34 deletions component/template/hooks/pre-get-repository.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -55,40 +55,6 @@ if use_gitserver == "true" || use_gitserver == true {
variable::set("repository", "");
}

if !variable::is_set("crossterm_io") {
let crossterm_io = variable::prompt("Use stdout or stderr for Crossterm IO?", "stdout", ["stdout", "stderr"]);
variable::set("crossterm_io", crossterm_io);
} else {
if variable::get("crossterm_io").to_lower() == "stdout" {
variable::set("crossterm_io", "stdout");
} else if variable::get("crossterm_io").to_lower() == "stderr" {
variable::set("crossterm_io", "stderr");
} else {
print("!!! Unknown value for `crossterm_io`: " + variable::get("crossterm_io") + ". Using `stdout`.");
variable::set("crossterm_io", "stdout");
}
};

let use_rustfmt = if variable::is_set("use_rustfmt") {
variable::get("use_rustfmt")
} else {
variable::prompt("Use an opinionated rustfmt.toml file?", "false", ["true", "false"])
};

if use_rustfmt == "false" || use_rustfmt == false {
file::delete("./.rustfmt.toml");
} else {
print("!!! opinionated rustfmt.toml requires nightly.");
variable::set("msrv", "nightly");
}

let msrv = if variable::is_set("msrv") {
variable::get("msrv")
} else {
variable::prompt("What is your Minimum Supported Rust Version", "stable")
};
variable::set("msrv", msrv);

let project_name = variable::get("project-name");
let crate_name = project_name;
crate_name.replace("-", "_");
Expand Down
2 changes: 0 additions & 2 deletions component/template/rust-toolchain.toml

This file was deleted.

27 changes: 11 additions & 16 deletions component/template/src/action.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
use std::{fmt, string::ToString};

use serde::{
de::{self, Deserializer, Visitor},
Deserialize, Serialize,
};
use serde::{Deserialize, Serialize};
use strum::Display;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Display, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Display, Serialize, Deserialize)]
pub enum Action {
Tick,
Render,
Resize(u16, u16),
Suspend,
Resume,
Quit,
ClearScreen,
Error(String),
Help,
Tick,
Render,
Resize(u16, u16),
Suspend,
Resume,
Quit,
ClearScreen,
Error(String),
Help,
}
Loading