Compare commits

...

4 Commits

Author SHA1 Message Date
Silas Schöffel 37b3fc8b4f
build(flake): add pre-commit-hooks
This enforces formatting rules.
2024-05-08 20:51:09 +02:00
Silas Schöffel fb2931cf64
fix(ui): emphasize equal worth of frontends 2024-05-08 20:16:18 +02:00
Silas Schöffel 27f1709d0e
fix(ui): default to help message 2024-05-08 20:14:15 +02:00
Silas Schöffel 459661f03e
chore(gitignore): ignore plugin.txt 2024-05-08 19:52:30 +02:00
5 changed files with 90 additions and 14 deletions

4
.gitignore vendored
View File

@ -18,6 +18,7 @@
userdata/
trinitrix.log
plugin.txt
# build
/target
@ -29,6 +30,9 @@ trinitrix.log
.idea
.direnv
# Pre Commit hooks
.pre-commit-config.yaml
# LS
## lua
.luarc.json

View File

@ -56,6 +56,58 @@
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": [
"flake-compat"
],
"flake-utils": [
"flake-utils"
],
"gitignore": [
"gitignore"
],
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1714478972,
"narHash": "sha256-q//cgb52vv81uOuwz1LaXElp3XAe1TqrABXODAEF6Sk=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "2849da033884f54822af194400f8dff435ada242",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1714656196,
@ -77,6 +129,8 @@
"crane": "crane",
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"git-hooks": "git-hooks",
"gitignore": "gitignore",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"systems": "systems",

View File

@ -34,6 +34,16 @@
nixpkgs.follows = "nixpkgs";
};
};
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs = {
flake-compat.follows = "flake-compat";
flake-utils.follows = "flake-utils";
gitignore.follows = "gitignore";
nixpkgs.follows = "nixpkgs";
nixpkgs-stable.follows = "nixpkgs";
};
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
@ -43,6 +53,12 @@
};
# inputs for following
gitignore = {
url = "github:hercules-ci/gitignore.nix";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
systems = {
url = "github:nix-systems/x86_64-linux"; # only evaluate for this system
};
@ -62,6 +78,7 @@
self,
nixpkgs,
flake-utils,
git-hooks,
treefmt-nix,
crane,
rust-overlay,
@ -141,11 +158,19 @@
checks = {
inherit craneBuild;
formatting = treefmtEval.config.build.check self;
pre-commit = git-hooks.lib.${system}.run {
src = ./.;
hooks.treefmt = {
enable = true;
package = treefmtEval.config.build.wrapper;
};
};
};
formatter = treefmtEval.config.build.wrapper;
devShells.default = pkgs.mkShell {
inherit (self.checks.${system}.pre-commit) shellHook;
packages = with pkgs; [
cocogitto

View File

@ -24,11 +24,11 @@ use clap::{Parser, Subcommand};
/// A multi protocol chat client
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
#[command(author, version, about, long_about = None, arg_required_else_help(true))]
pub struct Args {
#[command(subcommand)]
/// The subcommand to execute, default is start
pub subcommand: Option<Command>,
/// The subcommand to execute, default is help
pub subcommand: Command,
// #[arg(long, short)]
// /// Path to the Lua config file, executed instead of the normal one
@ -39,8 +39,8 @@ pub struct Args {
}
#[derive(Subcommand, Debug)]
pub enum Command {
/// Starts the main TUI client
Start {},
/// Starts a TUI client
Tui {},
/// Starts a repl to the trinitry cli interpreter
Repl {},

View File

@ -35,15 +35,8 @@ async fn main() -> anyhow::Result<()> {
cli_log::init_cli_log!();
let args = Args::parse();
let command = args.subcommand.unwrap_or(Command::Start {});
match command {
Command::Start {} => {
todo!("The full ui is not yet finished");
let mut app = app::App::new(Repl::new()?)?;
// NOTE(@soispha): The `None` here is temporary <2024-05-03>
app.run(None, args.plugin_path).await?;
}
match args.subcommand {
Command::Tui {} => {}
Command::Repl {} => {
let mut app = app::App::new(Repl::new().context("Failed to setup repl")?)?;