Skip to content

Commit

Permalink
feat: add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
kettei-sproutty committed Oct 17, 2023
1 parent 98eefb2 commit f662231
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Check"

on:
push:
pull_request:

env:
RUSTFLAGS: "-Dwarnings"

jobs:
check:
name: "Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: clippy, rustfmt
- run: cargo fmt --all -- --check
- run: cargo clippy --all -- -D warnings
- run: cargo check --all
2 changes: 1 addition & 1 deletion src/command.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
#[derive(Serialize, Deserialize, Debug)]
pub struct Command {
pub id: u64,
pub timestamp: u64,
Expand Down
11 changes: 5 additions & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use dirs::config_dir;
use serde::{Deserialize, Serialize};

use crate::constants::APPLICATION_NAME;
Expand Down Expand Up @@ -63,7 +62,7 @@ impl ScuderiaTermConfig {
let config_path = Self::get_config_path();
let app_dir = Self::get_app_dir();

let config = std::fs::read_to_string(&config_path);
let config = std::fs::read_to_string(config_path);

match config {
Ok(config) => {
Expand All @@ -82,8 +81,8 @@ impl ScuderiaTermConfig {
}
}

pub fn save(&self) -> () {
let config = toml::to_string(&self).unwrap();
std::fs::write(Self::get_config_path(), config).unwrap();
}
// pub fn save(&self) -> () {
// let config = toml::to_string(&self).unwrap();
// std::fs::write(Self::get_config_path(), config).unwrap();
// }
}
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ mod command;
mod config;
mod constants;

use iced::executor;
use iced::theme::palette::Palette;
use iced::widget::column;
use iced::{executor, Application, Color, Sandbox, Settings, Theme};
use iced::{Application, Color, Settings, Theme};

fn main() -> iced::Result {
ScuderiaTerm::run(Settings::default())
Expand All @@ -31,18 +32,19 @@ impl Application for ScuderiaTerm {
self.config.title.clone()
}

fn new(flags: Self::Flags) -> (Self, iced::Command<Self::Message>) {
fn new(_flags: Self::Flags) -> (Self, iced::Command<Self::Message>) {
let config = config::ScuderiaTermConfig::load();
let history = Vec::new();

(Self { config, history }, iced::Command::none())
}

fn update(&mut self, message: Self::Message) -> iced::Command<Self::Message> {
fn update(&mut self, _message: Self::Message) -> iced::Command<Self::Message> {
iced::Command::none()
}

fn view(&self) -> iced::Element<'_, Self::Message> {
print!("{:?}", self.history);
column![].into()
}

Expand Down

0 comments on commit f662231

Please sign in to comment.