chore: format and clean up code

This commit is contained in:
askiiart 2025-01-17 22:58:41 -06:00
parent 97cacf0b56
commit 7d5d51f6e1
Signed by untrusted user who does not match committer: askiiart
GPG key ID: 6A32977DAF31746A
8 changed files with 12 additions and 22 deletions

2
.gitignore vendored
View file

@ -1,2 +1,2 @@
/target
/data
/data

View file

@ -1,6 +1,6 @@
services:
postgres:
image: 'docker.io/library/postgres:17-alpine'
image: "docker.io/library/postgres:17-alpine"
environment:
- POSTGRES_PASSWORD=ReplaceMeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
# if there's already a he/him gregory down the hall, then change it to `gregory_it_its`, to make sure you know it's gregory, the program, not gregory the he/him down the hall
@ -9,6 +9,6 @@ services:
- POSTGRES_USER=gregory
- POSTGRES_DB=gregory
volumes:
- './data:/var/lib/postgresql/data'
- "./data:/var/lib/postgresql/data"
ports:
- 9001:5432

View file

@ -1,3 +1,3 @@
# How commands are run
I was unable to find a way to directly run *multiple* commands via Docker/Podman. Instead of doing that, greg puts all the commands in a temporary script, mounts it inside, and then run it with
I was unable to find a way to directly run *multiple* commands via Docker/Podman. Instead of doing that, greg puts all the commands in a temporary script, mounts it inside, and then run it with

View file

@ -5,7 +5,7 @@ max-threads = 10
[packages.librewolf]
dependencies = ["some-librewolf-dependency"]
dependencies = ["some-librewolf-dependency"]
[packages.librewolf.compilation]
id = "1"
@ -53,4 +53,4 @@ max-threads = 10
[volumes]
librewolf = "./data/librewolf:/librewolf"
other-workspace = "./data/other-workspace:/workspace"
fedora-repo = "./data/fedora-repo:/fedora-repo"
fedora-repo = "./data/fedora-repo:/fedora-repo"

View file

@ -80,12 +80,12 @@ pub(crate) struct JobExitStatus {
/// The [`Job`] this status is from
pub(crate) job: Job,
/// The status code returned by the command - note that this can be None if the program exits due to a signal like SIGKILL.
///
///
/// This is stored as a u16 rather than a u8 so that 65535 can be returned if there is no exit code rather than doing an Option or something, which I fear will probably come back to haunt me, but whatever
/// Update: I knew it. Why did I do this. Anyways this is gonna be an Option<i32> like Command uses now
///
///
/// Hell this isn't even coming back to haunt me for any sane reason, it's because I went with the actually sensible decision of Option<i32> in better-commands, so if I want to use that then I'm stuck using this.
///
///
/// Anyways I'll stop rambling now.
pub(crate) exit_code: Option<i32>,
/// Where the log is
@ -174,4 +174,4 @@ pub(crate) fn data() -> String {
pub(crate) fn dependencies() -> Vec<String> {
return Vec::new();
}
}

View file

@ -1,10 +1,6 @@
use crate::errors::Error;
use std::fs::{File, OpenOptions};
use std::io::Write;
use std::sync::{Arc, Mutex};
use std::{
fs::{File, OpenOptions},
os::unix::fs::FileExt,
};
/// The logger for gregory itself - NOT for jobs
pub(crate) struct Logger {
@ -80,5 +76,4 @@ impl JobLogger {
}
}
}
}
}

View file

@ -1,10 +1,8 @@
use crate::cli::*;
use crate::data::*;
use alphanumeric_sort::sort_str_slice;
use better_commands;
use clap::{CommandFactory, Parser};
use clap_complete::aot::{generate, Bash, Elvish, Fish, PowerShell, Zsh};
use std::fs;
use std::fs::create_dir_all;
use std::fs::remove_dir_all;
use std::fs::write;
@ -15,7 +13,6 @@ use std::path::Path;
use std::process::Command;
use std::sync::Arc;
use std::sync::Mutex;
use std::time::Instant;
use uuid::Uuid;
mod cli;
@ -97,7 +94,6 @@ fn run_job(conf: Config, job: Job) -> JobExitStatus {
logging::JobLogger::new(log_path.clone()).unwrap(),
));
// write the script
let script_path = &format!("{}/tmp/{container_name}.sh", conf.data_dir); // can't select fields in the format!() {} thing, have to do this
let script_dir: &Path = Path::new(script_path).parent().unwrap(); // create dir for the script

View file

@ -1,4 +1,3 @@
use crate::data;
#[cfg(test)]
use alphanumeric_sort::sort_str_slice;