From a1f947eb5079d7aeee30c79178e3cb93a6bdda63 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Wed, 26 Mar 2025 12:53:26 -0700 Subject: [PATCH] Fix hyphen support in --prefix --- flake.nix | 2 +- src/main.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index ef47459..1688264 100644 --- a/flake.nix +++ b/flake.nix @@ -107,7 +107,7 @@ Some utility commands: wantedBy = [ "network.target" ]; serviceConfig = { ExecStart = '' - ${cfg.package}/bin/ji-chan --domain ${cfg.domain} --token ${cfg.token} --prefix "${builtins.replaceStrings ["\"" "-"] ["\\\"" "\\-"] cfg.prefix}" --hugo ${cfg.hugo} --guilds ${cfg.guildData} + ${cfg.package}/bin/ji-chan --domain ${cfg.domain} --token ${cfg.token} --prefix "${builtins.replaceStrings ["\""] ["\\\""] cfg.prefix}" --hugo ${cfg.hugo} --guilds ${cfg.guildData} ''; Restart = "always"; DynamicUser = true; diff --git a/src/main.rs b/src/main.rs index e417ebe..21650eb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,10 +29,11 @@ struct Arguments { #[clap(long = "token", help = "Discord token")] pub discord_token: String, #[clap(long, help = "Traditional text command prefix, including space, if any", default_value = "-h")] + #[structopt(allow_hyphen_values = true)] // clap will eat hyphens e.g. "-h" or -h otherwise pub prefix: String, #[clap(long, help = "Path to Hugo project where site rebuilds")] pub hugo: String, - #[clap(long = "guilds", help = "Guild data JSON file", default_value = "guilds.json")] + #[clap(long = "guilds", help = "Path to guild data JSON file", default_value = "guilds.json")] pub guild_data: String, }